perm filename OC.TEX[MF,ALS]1 blob sn#767306 filedate 1984-09-10 generic text, type T, neo UTF8
\input webmac
% This program is based on GFtype and in part contains material extracted from
% program GFtoPXL which, in turn, was extracted from GFtoAMF.
% Version 0 was implemented in June 1984.

% Here is TeX material that gets inserted after \input webmac
\def\hang{\hangindent 3em\noindent\ignorespaces}
\def\textindent#1{\hangindent2.5em\noindent\hbox to2.5em{\hss#1 }\ignorespaces}
\font\ninerm=amr9
\let\mc=\ninerm % medium caps for names like PASCAL
\font\tenss=amss10 % for `The METAFONTbook'
\def\PASCAL{{\mc PASCAL}}
\def\ph{{\mc PASCAL-H}}
\font\logo=manfnt % font used for the METAFONT logo
\def\MF{{\logo META}\-{\logo FONT}}
\def\<#1>{$\langle#1\rangle$}
\def\section{\mathhexbox278}
\let\swap=\leftrightarrow
\def\round{\mathop{\rm round}\nolimits}

\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space\number\day, \number\year}

\def\(#1){} % this is used to make section names sort themselves better
\def\9#1{} % this is used for sort keys in the index via @:sort key}{entry@>

\def\title{GFDOVER}
\def\topofcontents{\null
	\def\titlepage{F} % include headline on the contents page
	\def\rheader{\mainfont\hfil \contentspagenumber}
	\vfill
	\centerline{\titlefont The {\ttitlefont GFDOVER} processor}
	\vskip 15pt
	\centerline{(Version 0.1, September 1984)}
	\vfill}
\def\botofcontents{\vfill
	\centerline{\hsize 5in\baselineskip9pt
		\vbox{\ninerm\noindent
		The preparation of this report
		was supported in part by the National Science
		Foundation under grants IST-8201926 and MCS-8300984,
		and by the System Development Foundation. `\TeX' is a
		trademark of the American Mathematical Society.}}}
\pageno=\contentspagenumber \advance\pageno by 1

\N1.  Introduction.
The \.{GFDOVER} utility program reads binary generic-font (``\.{GF}'')
files that are produced by font compilers such as \MF, and generates
two output files as required by the \.{DOVER} printer.  One of these files
is an \.{OC} formatted file that differ from a \.{PXL} file in that the
raster is rotated 90 degrees, that is, scanned from bottom-to-top,
left-to-right to conform with the Dover's scan, and also differs in detail
as to the overall format.  The second file is a \.{WD} formatted file that
contains the width information that \.{DOVER} requires.

The \\{banner} string defined here should be changed whenever \.{GFDOVER}
gets modified.

\Y\P\D \37$\\{banner}\S\.{\'This\ is\ GFDOVER,\ Version\ 0.1\'}$\C{printed when
the program starts}\par
\P\D \37$\\{resolution}\S384.0$\C{pixels per inch, standard for the DOVER}\par
\P\D \37$\\{xresolution}\S5.313408$\C{pixels per point}\par
\P\D \37$\\{yresolution}\S5.313408$\C{as used in \\{oc} and \\{wd} files}\par
\P\D \37$\\{ppi}\S72.27$\C{ Points per inch}\par
\fi

\M2. This program is written in standard \PASCAL, except where it is
necessary to use extensions; for example, one extension is to use a
default   \&{case}  as in \.{TANGLE}, \.{WEAVE}, etc.  All places where
nonstandard constructions are used have been listed in the index under
``system dependencies.''

\Y\P\D \37$\\{othercases}\S\\{others}$: \37\C{default for cases not listed
explicitly}\par
\P\D \37$\\{endcases}\S$\ \&{end} \C{follows the default case in an extended   %
\&{case}  statement}\par
\P\F \37$\\{othercases}\S\\{else}$\par
\P\F \37$\\{endcases}\S\\{end}$\par
\fi

\M3. The binary input comes from \\{gf\_file}, and the output font is written
on \\{oc\_file}.  Status reporting and error messages appear
on \PASCAL's standard \\{output} file. The term \\{print} is used instead of
\\{write} when this program writes on \\{output}, so that all such output
could easily be redirected if desired.

\Y\P\D \37$\\{print}(\#)\S\\{write}(\#)$\par
\P\D \37$\\{print\_ln}(\#)\S\\{write\_ln}(\#)$\par
\P\D \37$\\{print\_nl}\S\\{write\_ln}$\par
\Y\P\4\&{program}\1\  \37$\\{GF\_to\_OC}(\\{gf\_file},\39\\{oc\_file},\39\\{wd%
\_file},\39\\{output})$;\6
\4\&{label} \37\X4:Labels in the outer block\X\6
\4\&{const} \37\X5:Constants in the outer block\X\6
\4\&{type} \37\X12:Types in the outer block\X\6
\4\&{var} \37\X10:Globals in the outer block\X\6
\4\&{procedure}\1\  \37\\{initialize};\C{this procedure gets things started
properly}\6
\4\&{var} \37\|i: \37\\{integer};\C{loop index for initializations}\2\6
\&{begin} \37$\\{print\_ln}(\\{banner})$;\6
\X15:Set initial values\X\6
\&{end};\par
\fi

\M4. If the program has to stop prematurely, it goes to the
`\\{final\_end}'.

\Y\P\D \37$\\{final\_end}=9999$\C{label for the end of it all}\par
\Y\P$\4\X4:Labels in the outer block\X\S$\6
\\{final\_end};\par
\U section~3.\fi

\M5. The following parameters can be changed at compile time to extend or
reduce \\{GF\_to\_OC}'s capacity. The use of 127 as the \\{max\_glyph\_no} is
required by \.{DOVER}, although we may want to arrange to allow this
number to be increased to 255.

\Y\P$\4\X5:Constants in the outer block\X\S$\6
$\\{line\_length}=79$;\C{bracketed lines of output will be at most this long}\6
$\\{terminal\_line\_length}=150$;\C{maximum number of characters input in a
single 	line of input from the terminal}\6
$\\{max\_glyph\_no}=127$;\C{maximum glyph number in font}\6
$\\{top\_pixel}=400$;\C{boundary of pixel image of glyph}\6
$\\{bot\_pixel}=-150$;\5
$\\{left\_pixel}=-150$;\5
$\\{right\_pixel}=400$;\5
$\\{max\_p\_c}=50$;\par
\A section~64.
\U section~3.\fi

\M6. Here are some macros for common programming idioms.

\Y\P\D \37$\\{incr}(\#)\S\#\K\#+1$\C{increase a variable by unity}\par
\P\D \37$\\{decr}(\#)\S\#\K\#-1$\C{decrease a variable by unity}\par
\P\D \37$\\{negate}(\#)\S\#\K-\#$\C{change the sign of a variable}\par
\P\D \37$\\{do\_nothing}\S$\C{empty statement}\par
\P\D \37$\\{min\_y\_allowed}\S\\{bot\_pixel}$\par
\P\D \37$\\{max\_y\_allowed}\S\\{top\_pixel}$\par
\P\D \37$\\{min\_x\_allowed}\S\\{left\_pixel}$\par
\P\D \37$\\{max\_x\_allowed}\S\\{right\_pixel}$\par
\fi

\M7. If the \.{GF} file is badly malformed, the whole process must be aborted;
\.{GFDOVER} will give up, after issuing an error message about the symptoms
that were noticed.

Such errors might be discovered inside of subroutines inside of subroutines,
so a procedure called \\{jump\_out} has been introduced. This procedure, which
simply transfers control to the label \\{final\_end} at the end of the program,
contains the only non-local \&{goto}  statement in \.{GFDOVER}.

\Y\P\D \37$\\{abort}(\#)\S$\1\6
\&{begin} \37$\\{print}(\.{\'\ \'},\39\#)$;\5
\\{jump\_out};\6
\&{end}\2\par
\P\D \37$\\{bad\_gf}(\#)\S\\{abort}(\.{\'Bad\ GF\ file:\ \'},\39\#,\39\.{\'!%
\'})$\par
\Y\P\4\&{procedure}\1\  \37\\{jump\_out};\2\6
\&{begin} \37\&{goto} \37\\{final\_end};\6
\&{end};\par
\fi

\M8. We copy the following routine from \MF.

\Y\P\D \37$\\{unity}\S\O{200000}$\C{$2↑{16}$, represents 1.00000}\par
\fi

\M9. We will need the following procedures:

\Y\P\4\&{procedure}\1\  \37$\\{print\_scaled}(\|s:\\{integer})$;\C{prints
scaled real, rounded to five 	digits}\6
\4\&{var} \37\\{delta}: \37\\{integer};\C{amount of allowable inaccuracy}\2\6
\&{begin} \37\&{if} $\|s<0$ \1\&{then}\6
\&{begin} \37$\\{print}(\.{\'-\'})$;\5
$\\{negate}(\|s)$;\C{print the sign, if negative}\6
\&{end};\2\6
$\\{print}(\|s\mathbin{\&{div}}\\{unity}:1)$;\C{print the integer part}\6
$\|s\K10\ast(\|s\mathbin{\&{mod}}\\{unity})+5$;\6
\&{if} $\|s\I5$ \1\&{then}\6
\&{begin} \37$\\{delta}\K10$;\5
$\\{print}(\.{\'.\'})$;\6
\1\&{repeat} \37\&{if} $\\{delta}>\\{unity}$ \1\&{then}\5
$\|s\K\|s+\O{100000}-(\\{delta}\mathbin{\&{div}}2)$;\C{round the final digit}\2%
\6
$\\{print}(\\{chr}(\\{ord}(\.{\'0\'})+(\|s\mathbin{\&{div}}\\{unity})))$;\5
$\|s\K10\ast(\|s\mathbin{\&{mod}}\\{unity})$;\5
$\\{delta}\K\\{delta}\ast10$;\6
\4\&{until}\5
$\|s\L\\{delta}$;\2\6
\&{end};\2\6
\&{end};\par
\fi

\N10.  Optional modes of output.
The following is left in the program to simplify the addition of some
input and output routines should these be needed later.

The \\{input\_ln} routine waits for the user to type a line at his or her
terminal; then it puts ASCII-code equivalents for the characters on that line
into the \\{buffer} array. The \\{term\_in} file is used for terminal input,
and \\{term\_out} for terminal output.

\Y\P$\4\X10:Globals in the outer block\X\S$\6
\4\\{buffer}: \37\&{array} $[0\to\\{terminal\_line\_length}]$ \1\&{of}\5
\\{ASCII\_code};\2\6
\4\\{term\_in}: \37\\{text\_file};\C{the terminal, considered as an input file}%
\6
\4\\{term\_out}: \37\\{text\_file};\C{the terminal, considered as an output
file}\par
\A sections~14, 25, 31, 38, 40, 49, 69, 74, and~80.
\U section~3.\fi

\M11. Humdrum.
\Y\P\4\&{function}\1\  \37$\\{lower\_casify}(\|c:\\{ASCII\_code})$: \37\\{ASCII%
\_code};\2\6
\&{begin} \37\&{if} $(\|c\G\.{"A"})\W(\|c\L\.{"Z"})$ \1\&{then}\5
$\\{lower\_casify}\K\|c+\.{"a"}-\.{"A"}$\6
\4\&{else} $\\{lower\_casify}\K\|c$;\2\6
\&{end};\par
\fi

\N12.  The character set.
Like all programs written with the  \.{WEB} system, \.{GFDOVER} can be
used with any character set. But it uses ASCII code internally, because
the programming for portable input-output is easier when a fixed internal
code is used.

The next few sections of \.{GFDOVER} have therefore been copied from the
analogous ones in the \.{WEB} system routines. They have been considerably
simplified, since \.{GFDOVER} need not deal with the controversial
ASCII codes less than \O{40}. If such codes appear in the \.{GF} file,
they will be printed as question marks.

\Y\P$\4\X12:Types in the outer block\X\S$\6
$\\{ASCII\_code}=\.{"\ "}\to\.{"\~"}$;\C{a subrange of the integers}\par
\A sections~13, 24, 37, and~39.
\U section~3.\fi

\M13. The original \PASCAL\ compiler was designed in the late 60s, when six-bit
character sets were common, so it did not make provision for lower case
letters. Nowadays, of course, we need to deal with both upper and lower case
alphabets in a convenient way, especially in a program like \.{GFDOVER}.
So we shall assume that the \PASCAL\ system being used for \.{GFDOVER}
has a character set containing at least the standard visible characters
of ASCII code (\.{"!"} through \.{"\~"}).

Some \PASCAL\ compilers use the original name \\{char} for the data type
associated with the characters in text files, while other \PASCAL s
consider \\{char} to be a 64-element subrange of a larger data type that has
some other name.  In order to accommodate this difference, we shall use
the name \\{text\_char} to stand for the data type of the characters in the
output file.  We shall also assume that \\{text\_char} consists of
the elements $\\{chr}(\\{first\_text\_char})$ through $\\{chr}(\\{last\_text%
\_char})$,
inclusive. The following definitions should be adjusted if necessary.

\Y\P\D \37$\\{text\_char}\S\\{char}$\C{the data type of characters in text
files}\par
\P\D \37$\\{first\_text\_char}=0$\C{ordinal number of the smallest element of %
\\{text\_char}}\par
\P\D \37$\\{last\_text\_char}=127$\C{ordinal number of the largest element of %
\\{text\_char}}\par
\Y\P$\4\X12:Types in the outer block\X\mathrel{+}\S$\6
$\\{text\_file}=$\1\5
\&{packed} \37\&{file} \1\&{of}\5
\\{text\_char};\2\2\par
\fi

\M14. The \.{GFDOVER} processor converts between ASCII code and
the user's external character set by means of arrays \\{xord} and \\{xchr}
that are analogous to \PASCAL's \\{ord} and \\{chr} functions.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{xord}: \37\&{array} $[\\{text\_char}]$ \1\&{of}\5
\\{ASCII\_code};\C{specifies conversion of input characters}\2\6
\4\\{xchr}: \37\&{array} $[0\to255]$ \1\&{of}\5
\\{text\_char};\C{specifies conversion of output characters}\2\par
\fi

\M15. Under our assumption that the visible characters of standard ASCII are
all present, the following assignment statements initialize the
\\{xchr} array properly, without needing any system-dependent changes.

\Y\P$\4\X15:Set initial values\X\S$\6
\&{for} $\|i\K0\mathrel{\&{to}}\O{37}$ \1\&{do}\5
$\\{xchr}[\|i]\K\.{\'?\'}$;\2\6
$\\{xchr}[\O{40}]\K\.{\'\ \'}$;\5
$\\{xchr}[\O{41}]\K\.{\'!\'}$;\5
$\\{xchr}[\O{42}]\K\.{\'"\'}$;\5
$\\{xchr}[\O{43}]\K\.{\'\#\'}$;\5
$\\{xchr}[\O{44}]\K\.{\'\$\'}$;\5
$\\{xchr}[\O{45}]\K\.{\'\%\'}$;\5
$\\{xchr}[\O{46}]\K\.{\'\&\'}$;\5
$\\{xchr}[\O{47}]\K\.{\'\'}\.{\'\'}$;\6
$\\{xchr}[\O{50}]\K\.{\'(\'}$;\5
$\\{xchr}[\O{51}]\K\.{\')\'}$;\5
$\\{xchr}[\O{52}]\K\.{\'*\'}$;\5
$\\{xchr}[\O{53}]\K\.{\'+\'}$;\5
$\\{xchr}[\O{54}]\K\.{\',\'}$;\5
$\\{xchr}[\O{55}]\K\.{\'-\'}$;\5
$\\{xchr}[\O{56}]\K\.{\'.\'}$;\5
$\\{xchr}[\O{57}]\K\.{\'/\'}$;\6
$\\{xchr}[\O{60}]\K\.{\'0\'}$;\5
$\\{xchr}[\O{61}]\K\.{\'1\'}$;\5
$\\{xchr}[\O{62}]\K\.{\'2\'}$;\5
$\\{xchr}[\O{63}]\K\.{\'3\'}$;\5
$\\{xchr}[\O{64}]\K\.{\'4\'}$;\5
$\\{xchr}[\O{65}]\K\.{\'5\'}$;\5
$\\{xchr}[\O{66}]\K\.{\'6\'}$;\5
$\\{xchr}[\O{67}]\K\.{\'7\'}$;\6
$\\{xchr}[\O{70}]\K\.{\'8\'}$;\5
$\\{xchr}[\O{71}]\K\.{\'9\'}$;\5
$\\{xchr}[\O{72}]\K\.{\':\'}$;\5
$\\{xchr}[\O{73}]\K\.{\';\'}$;\5
$\\{xchr}[\O{74}]\K\.{\'<\'}$;\5
$\\{xchr}[\O{75}]\K\.{\'=\'}$;\5
$\\{xchr}[\O{76}]\K\.{\'>\'}$;\5
$\\{xchr}[\O{77}]\K\.{\'?\'}$;\6
$\\{xchr}[\O{100}]\K\.{\'@\'}$;\5
$\\{xchr}[\O{101}]\K\.{\'A\'}$;\5
$\\{xchr}[\O{102}]\K\.{\'B\'}$;\5
$\\{xchr}[\O{103}]\K\.{\'C\'}$;\5
$\\{xchr}[\O{104}]\K\.{\'D\'}$;\5
$\\{xchr}[\O{105}]\K\.{\'E\'}$;\5
$\\{xchr}[\O{106}]\K\.{\'F\'}$;\5
$\\{xchr}[\O{107}]\K\.{\'G\'}$;\6
$\\{xchr}[\O{110}]\K\.{\'H\'}$;\5
$\\{xchr}[\O{111}]\K\.{\'I\'}$;\5
$\\{xchr}[\O{112}]\K\.{\'J\'}$;\5
$\\{xchr}[\O{113}]\K\.{\'K\'}$;\5
$\\{xchr}[\O{114}]\K\.{\'L\'}$;\5
$\\{xchr}[\O{115}]\K\.{\'M\'}$;\5
$\\{xchr}[\O{116}]\K\.{\'N\'}$;\5
$\\{xchr}[\O{117}]\K\.{\'O\'}$;\6
$\\{xchr}[\O{120}]\K\.{\'P\'}$;\5
$\\{xchr}[\O{121}]\K\.{\'Q\'}$;\5
$\\{xchr}[\O{122}]\K\.{\'R\'}$;\5
$\\{xchr}[\O{123}]\K\.{\'S\'}$;\5
$\\{xchr}[\O{124}]\K\.{\'T\'}$;\5
$\\{xchr}[\O{125}]\K\.{\'U\'}$;\5
$\\{xchr}[\O{126}]\K\.{\'V\'}$;\5
$\\{xchr}[\O{127}]\K\.{\'W\'}$;\6
$\\{xchr}[\O{130}]\K\.{\'X\'}$;\5
$\\{xchr}[\O{131}]\K\.{\'Y\'}$;\5
$\\{xchr}[\O{132}]\K\.{\'Z\'}$;\5
$\\{xchr}[\O{133}]\K\.{\'[\'}$;\5
$\\{xchr}[\O{134}]\K\.{\'\\\'}$;\5
$\\{xchr}[\O{135}]\K\.{\']\'}$;\5
$\\{xchr}[\O{136}]\K\.{\'\↑\'}$;\5
$\\{xchr}[\O{137}]\K\.{\'\_\'}$;\6
$\\{xchr}[\O{140}]\K\.{\'\`\'}$;\5
$\\{xchr}[\O{141}]\K\.{\'a\'}$;\5
$\\{xchr}[\O{142}]\K\.{\'b\'}$;\5
$\\{xchr}[\O{143}]\K\.{\'c\'}$;\5
$\\{xchr}[\O{144}]\K\.{\'d\'}$;\5
$\\{xchr}[\O{145}]\K\.{\'e\'}$;\5
$\\{xchr}[\O{146}]\K\.{\'f\'}$;\5
$\\{xchr}[\O{147}]\K\.{\'g\'}$;\6
$\\{xchr}[\O{150}]\K\.{\'h\'}$;\5
$\\{xchr}[\O{151}]\K\.{\'i\'}$;\5
$\\{xchr}[\O{152}]\K\.{\'j\'}$;\5
$\\{xchr}[\O{153}]\K\.{\'k\'}$;\5
$\\{xchr}[\O{154}]\K\.{\'l\'}$;\5
$\\{xchr}[\O{155}]\K\.{\'m\'}$;\5
$\\{xchr}[\O{156}]\K\.{\'n\'}$;\5
$\\{xchr}[\O{157}]\K\.{\'o\'}$;\6
$\\{xchr}[\O{160}]\K\.{\'p\'}$;\5
$\\{xchr}[\O{161}]\K\.{\'q\'}$;\5
$\\{xchr}[\O{162}]\K\.{\'r\'}$;\5
$\\{xchr}[\O{163}]\K\.{\'s\'}$;\5
$\\{xchr}[\O{164}]\K\.{\'t\'}$;\5
$\\{xchr}[\O{165}]\K\.{\'u\'}$;\5
$\\{xchr}[\O{166}]\K\.{\'v\'}$;\5
$\\{xchr}[\O{167}]\K\.{\'w\'}$;\6
$\\{xchr}[\O{170}]\K\.{\'x\'}$;\5
$\\{xchr}[\O{171}]\K\.{\'y\'}$;\5
$\\{xchr}[\O{172}]\K\.{\'z\'}$;\5
$\\{xchr}[\O{173}]\K\.{\'\{\'}$;\5
$\\{xchr}[\O{174}]\K\.{\'|\'}$;\5
$\\{xchr}[\O{175}]\K\.{\'\}\'}$;\5
$\\{xchr}[\O{176}]\K\.{\'\~\'}$;\6
\&{for} $\|i\K\O{177}\mathrel{\&{to}}255$ \1\&{do}\5
$\\{xchr}[\|i]\K\.{\'?\'}$;\2\par
\A sections~16, 41, and~75.
\U section~3.\fi

\M16. The following system-independent code makes the \\{xord} array contain a
suitable inverse to the information in \\{xchr}.

\Y\P$\4\X15:Set initial values\X\mathrel{+}\S$\6
\&{for} $\|i\K\\{first\_text\_char}\mathrel{\&{to}}\\{last\_text\_char}$ \1%
\&{do}\5
$\\{xord}[\\{chr}(\|i)]\K\O{40}$;\2\6
\&{for} $\|i\K\.{"\ "}\mathrel{\&{to}}\.{"\~"}$ \1\&{do}\5
$\\{xord}[\\{xchr}[\|i]]\K\|i$;\2\par
\fi

\N17.  Generic font file format.
The most important output produced by a production run of \MF\ is the
``generic font'' (\.{GF}) file that specifies the bit patterns of the
characters that have been drawn. The term {\sl generic\/} indicates that
this file format doesn't match the conventions of any name-brand manufacturer;
but it is easy to convert \.{GF} files to the special format required by
almost all digital phototypesetting equipment. There's a strong analogy
between the \.{DVI} files written by \TeX\ and the \.{GF} files written
by \MF; and, in fact, the file formats have a lot in common.

A \.{GF} file is a stream of 8-bit bytes that may be
regarded as a series of commands in a machine-like language. The first
byte of each command is the operation code, and this code is followed by
zero or more bytes that provide parameters to the command. The parameters
themselves may consist of several consecutive bytes; for example, the
`\\{boc}' (beginning of character) command has seven parameters, each of
which is four bytes long. Parameters are usually regarded as nonnegative
integers; but four-byte-long parameters can be either positive or
negative, hence they range in value from $-2↑{31}$ to $2↑{31}-1$.
As in \.{TFM} files, numbers that occupy
more than one byte position appear in BigEndian order,
and negative numbers appear in two's complement notation.

A \.{GF} file consists of a ``preamble,'' followed by a sequence of one or
more ``characters,'' followed by a ``postamble.'' The preamble is simply a
\\{pre} command, with its parameters that introduce the file; this must come
first.  Each ``character'' consists of a \\{boc} command, followed by any
number of other commands that specify the ``black'' pixels of a character,
followed by an \\{eoc} command. The characters appear in the order that \MF\
generated them. If we ignore no-op commands (which are allowed between any
two commands in the file), each \\{eoc} command is immediately followed by a
\\{boc} command, or by a \\{post} command; in the latter case, there are no
more characters in the file, and the remaining bytes form the postamble.
Further details about the postamble will be explained later.

Some parameters in \.{GF} commands are ``pointers.'' These are four-byte
quantities that give the location number of some other byte in the file;
the first byte is number~0, then comes number~1, and so on.

\fi

\M18. The \.{GF} format is intended to be both compact and easily interpreted
by a machine. Compactness is achieved by making most of the information
relative instead of absolute. When a \.{GF}-reading program reads the
commands for a character, it keeps track of several quantities: (a)~the current
row number,~\|y; (b)~the current column number,~\|x; and (c)~the current
starting-column number,~\|z. These are 32-bit signed integers, although
most actual font formats produced from \.{GF} files will need to curtail
this vast range because of practical limitations. (\MF\ output will never
allow $\vert x\vert$, $\vert y\vert$, or $\vert z\vert$ to exceed 4095,
but the \.{GF} format tries to be more general.)

How do \.{GF}'s row and column numbers correspond to the conventions
of \TeX\ and \MF? Well, the ``reference point'' of a character, in \TeX's
view, is considered to be at the lower left corner of the pixel in row~0
and column~0. This point is the intersection of the baseline with the left
edge of the type; it corresponds to location $(0,0)$ in \MF\ programs.
Thus the pixel in row~0 and column~0 is \MF's unit square, comprising the
region of the plane whose coordinates both lie between 0 and~1. Negative
values of~\|y correspond to rows of pixels {\sl below\/} the baseline.

Besides \|x, \|y, and \|z, there's also a fourth aspect of the current
state, namely the \\{paint\_switch}, which is always either \\{black} or
\\{white}. Each \\{paint} command advances \|x by a specified amount~\|d,
and blackens the intervening pixels if $\\{paint\_switch}=\\{black}$; then
the \\{paint\_switch} changes its state. \.{GF}'s commands are designed so
that \|x will never decrease within a row, and \|y will never increase
within a character; hence there is no way to whiten a pixel that has
been blackened. Rather than using the \\{paint\_switch} parameter directly,
as is done in \.{GFTYPE}, we will find it convenient to store values in a
\\{paint\_val} array, as will be explained in more detail below.

\fi

\M19. Here is a list of all the commands that may appear in a \.{GF} file. Each
command is specified by its symbolic name (e.g., \\{boc}), its opcode byte
(e.g., 67), and its parameters (if any). The parameters are followed
by a bracketed number telling how many bytes they occupy; for example,
`$\|d[2]$' means that parameter \|d is two bytes long.

\yskip\hang\\{paint\_0} 0. This is a \\{paint} command with $\|d=0$; it does
nothing but change the \\{paint\_switch} from \\{black} to \\{white} or
vice~versa.

\yskip\hang\\{paint\_1} through \\{paint\_63} (opcodes 1 to 63).
These are \\{paint} commands with $\|d=1$ to~63, defined as follows: If
$\\{paint\_switch}=\\{black}$, blacken \|d~pixels of the current row~\|y,
in columns \|x through $\|x+\|d-1$ inclusive. Then, in any case,
complement the \\{paint\_switch} and advance \|x by~\|d.

\yskip\hang\\{paint1} 64 $\|d[1]$. This is a \\{paint} command with a specified
value of~\|d; \MF\ uses it to paint when $64\L\|d<256$.

\yskip\hang\\{paint2} 65 $\|d[2]$. Same as \\{paint1}, but \|d~can be as high
as~65535.

\yskip\hang\\{paint3} 66 $\|d[3]$. Same as \\{paint1}, but \|d~can be as high
as $2↑{24}-1$. \MF\ never needs this command, and it is hard to imagine
anybody making practical use of it; surely a more compact encoding will be
desirable when characters can be this large. But the command is there,
anyway, just in case.

\yskip\hang\\{boc} 67 $\|c[4]$ $\|p[4]$ $\\{min\_x}[4]$ $\\{max\_x}[4]$ $\\{min%
\_y}[4]$
$\\{max\_y}[4]$ $\|z[4]$. Beginning of a character:  Here \|c is the character
code, and \|p points to the previous \\{boc} command (if any) for characters
having this code number modulo 256.  (The pointer \|p is $-1$ if there was
no prior character with an equivalent code.) All $x$-coordinates of black
pixels in the character that follows will be $\G\\{min\_x}$ and $\L\\{max\_x}$;
all
$y$-coordinates of black pixels will be $\G\\{min\_y}$ and $\L\\{max\_y}$.
Finally,
\|z~is the leftmost potentially black column in row \\{max\_y}; it satisfies
$\\{min\_x}\L\|z\L\\{max\_x}$. When a \.{GF}-reading program sees a \\{boc}, it
can use
\\{min\_x}, \\{max\_x}, \\{min\_y}, and \\{max\_y} to initialize the bounds of
an
array. Then it sets $\|y\K\\{max\_y}$, $\\{paint\_switch}\K\\{black}$, and
initializes its
\|x and \|z registers to the stated value of~\|z.

\yskip\hang\\{eoc} 68. End of character: All pixels blackened so far
constitute the pattern for this character. In particular, a completely
blank character might have \\{eoc} immediately following \\{boc}.

\yskip\hang\\{skip1} 69 $\|m[1]$. Decrease \|y by $\|m+1$, set $\|x\K\|z$, and
set
$\\{paint\_switch}\K\\{black}$. This is a way to produce \|m all-white rows.

\yskip\hang\\{skip2} 70 $\|m[2]$. Same as \\{skip1}, but \|m can be as large
as 65535.

\yskip\hang\\{skip3} 71 $\|m[3]$. Same as \\{skip1}, but \|m can be as large
as $2↑{24}-1$. \MF\ obviously never needs this command.

\yskip\hang\\{new\_row} 72 $\|u[4]$. Decrease \|y by 1 and set $\|z\K\|z+\|u$;
then set
$\|x\K\|z$ and $\\{paint\_switch}\K\\{black}$. (It's a general way to finish
one row
and begin another.)

\yskip\hang\\{left\_z\_83} through \\{left\_z\_1} (opcodes 73 to 155). Same as
\\{new\_row}, with $\|u=-83$ through $-1$, respectively.

\yskip\hang\\{right\_z\_0} 156. Same as \\{skip1} with $\|m=0$ or \\{new\_row}
with
$\|u=0$.

\yskip\hang\\{right\_z\_1} through \\{right\_z\_83} (opcodes 157 to 239). Same
as
\\{new\_row}, with $\|u=+1$ through $+83$, respectively. \MF\ generates a
\\{new\_row} command only when $\vert u\vert>83$.

\yskip\hang\\{nop} 240. No operation, do nothing. Any number of \\{nop}'s
may occur between \.{GF} commands, but a \\{nop} cannot be inserted between
a command and its parameters or between two parameters.

\yskip\hang\\{xxx1} 241 $\|k[1]$ $\|x[\|k]$. This command is undefined in
general; it functions as a $(k+2)$-byte \\{nop} unless special \.{GF}-reading
programs are being used. \MF\ generates \\{xxx} commands when encountering
a \&{special} string; this occurs in the \.{GF} file only between
characters, after the preamble, and before the postamble. However, \\{xxx}
commands can appear anywhere. It is recommended that \|x be a string
having the form of a keyword followed by possible parameters relevant to
that keyword.

\yskip\hang\\{xxx2} 242 $\|k[2]$ $\|x[\|k]$. Like \\{xxx1}, but $0\L\|k<65536$.

\yskip\hang\\{xxx3} 243 $\|k[3]$ $\|x[\|k]$. Like \\{xxx1}, but $0\L\|k<%
\hbox{$2↑{24}$}$.
\MF\ uses this when sending a \&{special} string whose length exceeds~255.

\yskip\hang\\{xxx4} 244 $\|k[4]$ $\|x[\|k]$. Like \\{xxx1}, but \|k can be
ridiculously large; \|k mustn't be negative.

\yskip\hang\\{yyy} 245 $\|n[4]$. This command is undefined in general;
it functions as a 5-byte \\{nop} unless special \.{GF}-reading programs
are being used. \MF\ puts scaled numbers into \\{yyy}'s, as a
result of \&{numspecial} commands; the intent is to provide numeric
parameters to \\{xxx} commands that immediately precede.

\yskip\hang\\{char\_loc} 246 $\|c[1]$ $\|v[4]$ $\|w[4]$ $\|p[4]$.
This command will appear only in the postamble, which will be explained
shortly.

\yskip\hang\\{pre} 247 $\|i[1]$ $\|k[1]$ $\|x[\|k]$.
Beginning of the preamble; this must come at the very beginning of the
file. Parameter \|i is an identifying number for \.{GF} format, currently
129. The other information is merely commentary; it is not given
special interpretation like \\{xxx} commands are. (Note that \\{xxx}
commands may immediately follow the preamble, before the first \\{boc}.)

\yskip\hang\\{post} 248. Beginning of the postamble, see below.

\yskip\hang\\{post\_post} 249. Ending of the postamble, see below.

\yskip\noindent Commands 250--255 are undefined at the present time.

\Y\P\D \37$\\{gf\_id\_byte}=129$\C{identifies the kind of \.{GF} files
described here}\par
\fi

\M20. Here are the opcodes \.{GFDOVER} actually refers to.

\Y\P\D \37$\\{paint\_0}=0$\C{beginning of the \\{paint} commands}\par
\P\D \37$\\{paint1}=64$\C{move right a given number of columns, then 	black${}%
\swap{}$white}\par
\P\D \37$\\{boc}=67$\C{beginning of a character}\par
\P\D \37$\\{eoc}=68$\C{end of a character}\par
\P\D \37$\\{skip1}=69$\C{skip over blank rows}\par
\P\D \37$\\{new\_row}=72$\C{move down one row and adjust \|z}\par
\P\D \37$\\{right\_z\_0}=156$\C{base of shorthand \\{new\_row} commands}\par
\P\D \37$\\{right\_z\_1}=157$\C{next shorthand \\{new\_row} command}\par
\P\D \37$\\{right\_z\_83}=239$\C{last shorthand \\{new\_row} command}\par
\P\D \37$\\{left\_z\_83}=73$\C{first shorthand \\{new\_row} command}\par
\P\D \37$\\{nop}=240$\C{no operation}\par
\P\D \37$\\{xxx1}=241$\C{for \&{special} strings}\par
\P\D \37$\\{yyy}=245$\C{for \&{numspecial} numbers}\par
\P\D \37$\\{char\_loc}=246$\C{character locators in the postamble}\par
\P\D \37$\\{pre}=247$\C{preamble}\par
\P\D \37$\\{post}=248$\C{postamble beginning}\par
\P\D \37$\\{post\_post}=249$\C{postamble ending}\par
\P\D \37$\\{undefined\_commands}\S250,\39251,\39252,\39253,\39254,\39255$\par
\fi

\M21. The last character in a \.{GF} file is followed by `\\{post}'; this
command
introduces the postamble, which summarizes important facts that \MF\ has
accumulated. The postamble has the form
$$\vbox{\halign{\hbox{#\hfil}\cr
\\{post} $\|p[4]$ $\\{ds}[4]$ $\\{cs}[4]$ $\\{hppp}[4]$ $\\{vppp}[4]$
$\\{min\_x}[4]$ $\\{max\_x}[4]$ $\\{min\_y}[4]$ $\\{max\_y}[4]$\cr
$\langle\,$character locators$\,\rangle$\cr
\\{post\_post} $\|q[4]$ $\|i[1]$ 223's$[{\G}4]$\cr}}$$
Here \|p is a pointer to the byte following the final \\{eoc} in the file
(or to the byte following the preamble, if there are no characters);
it can be used to locate the beginning of \\{xxx} commands
that might have preceded the postamble. The \\{ds} and \\{cs} parameters
give the design size and check sum, respectively, which are exactly the
values put into the header of the \.{TFM} file that \MF\ produces (or
would produce) on this run. Parameters \\{hppp} and \\{vppp} are the ratios of
pixels per point, horizontally and vertically, expressed as \\{scaled} integers
(i.e., multiplied by $2↑{16}$); they can be used to correlate the font
with specific device resolutions, magnifications, and ``at sizes.''  Then
come \\{min\_x}, \\{max\_x}, \\{min\_y}, and \\{max\_y}, which bound the values
that \|x
and~\|y assume in all of the characters of this \.{GF} file.

\fi

\M22. Character locators are introduced by \\{char\_loc} commands,
which contain a character residue~\|c, a character device width~\|v,
a character width~\|w, and a pointer~\|p
to the beginning of that character. (If two or more characters have the
same code~\|c modulo 256, only the last will be indicated; the others can be
located by following backpointers. Characters whose codes differ by a
multiple of 256 are assumed to share the same font metric information,
hence the \.{TFM} file contains only residues of character codes modulo~256.
This convention is intended for oriental languages, when there are many
character shapes but few distinct widths.)

The character device width~\|v is the value of \MF's \&{chardw} parameter,
rounded to the nearest integer, i.e., the number of pixels that the font
designer wishes the character to occupy when it is typeset within a word.

The character width~\|w duplicates the information in the \.{TFM} file; it
is a \\{fix\_word} value relative to the design size, and it should be
independent of magnification.

The backpointer \|p points to the character's \\{boc}, or to the first of
a sequence of consecutive \\{nop} or \\{xxx} or \\{yyy} commands that
immediately precede the \\{boc}, if such commands exist; such ``special''
commands essentially belong to the characters, while the special commands
after the final character belong to the postamble (i.e., to the font
as a whole). This convention about \|p applies also to the backpointers
in \\{boc} commands, even though it wasn't explained in the description
of~\\{boc}.

\fi

\M23. The last part of the postamble, following the \\{post\_post} byte that
signifies the end of the character locators, contains \|q, a pointer to the
\\{post} command that started the postamble.  An identification byte, \|i,
comes next; this currently equals~129, as in the preamble.

The \|i byte is followed by four or more bytes that are all equal to
the decimal number 223 (i.e., \O{337} in octal). \MF\ puts out four to seven of
these trailing bytes, until the total length of the file is a multiple of
four bytes, since this works out best on machines that pack four bytes per
word; but any number of 223's is allowed, as long as there are at least four
of them. In effect, 223 is a sort of signature that is added at the very end.

This curious way to finish off a \.{GF} file makes it feasible for
\.{GF}-reading programs to find the postamble first, on most computers,
even though \MF\ wants to write the postamble last. Most operating
systems permit random access to individual words or bytes of a file, so
the \.{GF} reader can start at the end and skip backwards over the 223's
until finding the identification byte. Then it can back up four bytes, read
\|q, and move to byte \|q of the file. This byte should, of course,
contain the value 248 (\\{post}); now the postamble can be read, so the
\.{GF} reader can discover all the information needed for individual
characters.

Unfortunately, however, standard \PASCAL\ does not include the ability to
access a random position in a file, or even to determine the length of a file.
Almost all systems nowadays provide the necessary capabilities, so \.{GF}
format has been designed to work most efficiently with modern operating
systems.
But if \.{GF} files have to be processed under the restrictions of standard
\PASCAL, one can simply read them from front to back. This will
be adequate for most applications. However, the postamble-first approach
would facilitate a program that merges two \.{GF} files, replacing data
from one that is overridden by corresponding data in the other.
\fi

\N24.  Input and Output for binary files.
We have seen that a \.{GF} file is a sequence of 8-bit bytes. The bytes
appear physically in what is called a `\&{packed} \&{file} \&{of} $0\to255$'
in \PASCAL\ lingo.

Packing is system dependent, and many \PASCAL\ systems fail to implement
such files in a sensible way (at least, from the viewpoint of producing
good production software).  For example, some systems treat all
byte-oriented files as text, looking for end-of-line marks and such
things. Therefore some system-dependent code is often needed to deal with
binary files, even though most of the program in this section of
\.{GFDOVER} is written in standard \PASCAL.

We shall stick to simple \PASCAL\ in this program, for reasons of clarity,
even if such simplicity is sometimes unrealistic.

\Y\P$\4\X12:Types in the outer block\X\mathrel{+}\S$\6
$\\{eight\_bits}=0\to255$;\C{unsigned one-byte quantity}\6
$\\{byte\_file}=$\1\5
\&{packed} \37\&{file} \1\&{of}\5
\\{eight\_bits};\C{files that contain binary data}\2\2\par
\fi

\M25. The program deals with three binary file variables: \\{gf\_file} is the
input file that we are translating into \.{OC} format, to be written
on \\{oc\_file}, while we also accumulate width information that is written
on \\{wd\_file}.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{gf\_file}: \37\\{byte\_file};\C{the original source file}\6
\4\\{oc\_file}: \37\\{byte\_file};\C{the desired OC output file}\6
\4\\{wd\_file}: \37\\{byte\_file};\C{the desired WC output file}\par
\fi

\M26. To prepare the \\{gf\_file} for input, we \\{reset} it.

\fi

\M27. Opening packed binary files:
\Y\P\4\&{procedure}\1\  \37\\{open\_gf\_file};\C{prepares to read packed bytes
in \\{gf\_file}}\2\6
\&{begin} \37$\\{reset}(\\{gf\_file})$;\5
$\\{cur\_loc}\K0$;\6
\&{end};\par
\fi

\M28. To prepare the \\{oc\_file} for output, we \\{rewrite} it.

\Y\P\4\&{procedure}\1\  \37\\{open\_oc\_file};\C{prepares to write packed bytes
in \\{oc\_file}}\2\6
\&{begin} \37$\\{rewrite}(\\{oc\_file})$;\5
$\\{oc\_byte\_no}\K0$;\6
\&{end};\par
\fi

\M29. To prepare the \\{wd\_file} for output, we \\{rewrite} it.

\Y\P\4\&{procedure}\1\  \37\\{open\_wd\_file};\C{prepares to write packed bytes
in \\{wd\_file}}\2\6
\&{begin} \37$\\{rewrite}(\\{wd\_file})$;\5
$\\{wd\_byte\_no}\K0$;\6
\&{end};\par
\fi

\M30. To prepare the \\{wd\_file} for input, we \\{reset} it.

\Y\P\4\&{procedure}\1\  \37\\{reopen\_wd\_file};\C{prepares to read packed
bytes in \\{wd\_file}}\2\6
\&{begin} \37$\\{reset}(\\{wd\_file})$;\5
$\\{wd\_byte\_no}\K0$;\6
\&{end};\par
\fi

\M31. It should be noted that \\{cur\_loc} is a global variable that holds the
number of the byte about to be read next from \\{gf\_file}.  Likewise,
\\{oc\_byte\_no} holds the number of the byte about to be written next into
\\{oc\_file} while \\{wd\_byte\_no} holds the number of the byte about to be
written into \\{wd\_file}.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{cur\_loc}: \37\\{integer};\C{where we are about to look, in \\{gf\_file}}\6
\4\\{oc\_byte\_no}: \37\\{integer};\C{where we are about to write, in \\{oc%
\_file}}\6
\4\\{wd\_byte\_no}: \37\\{integer};\C{where we are about to write, in \\{wd%
\_file}}\par
\fi

\M32. We shall use a set of simple functions to read the next byte or
bytes from \\{gf\_file}. There are seven possibilities, each of which is
treated as a separate function in order to minimize the overhead for
subroutine calls.

\Y\P\4\&{function}\1\  \37\\{get\_byte}: \37\\{integer};\C{returns the next
byte, unsigned}\6
\4\&{var} \37\|b: \37\\{eight\_bits};\2\6
\&{begin} \37\&{if} $\\{eof}(\\{gf\_file})$ \1\&{then}\5
$\\{get\_byte}\K0$\6
\4\&{else} \&{begin} \37$\\{read}(\\{gf\_file},\39\|b)$;\5
$\\{incr}(\\{cur\_loc})$;\5
$\\{get\_byte}\K\|b$;\6
\&{end};\2\6
\&{end};\7
\4\&{function}\1\  \37\\{get\_two\_bytes}: \37\\{integer};\C{returns the next
two bytes, unsigned}\6
\4\&{var} \37$\|a,\39\|b$: \37\\{eight\_bits};\2\6
\&{begin} \37$\\{read}(\\{gf\_file},\39\|a)$;\5
$\\{read}(\\{gf\_file},\39\|b)$;\5
$\\{cur\_loc}\K\\{cur\_loc}+2$;\5
$\\{get\_two\_bytes}\K\|a\ast256+\|b$;\6
\&{end};\7
\4\&{function}\1\  \37\\{get\_three\_bytes}: \37\\{integer};\C{returns the next
three bytes, unsigned}\6
\4\&{var} \37$\|a,\39\|b,\39\|c$: \37\\{eight\_bits};\2\6
\&{begin} \37$\\{read}(\\{gf\_file},\39\|a)$;\5
$\\{read}(\\{gf\_file},\39\|b)$;\5
$\\{read}(\\{gf\_file},\39\|c)$;\5
$\\{cur\_loc}\K\\{cur\_loc}+3$;\5
$\\{get\_three\_bytes}\K(\|a\ast256+\|b)\ast256+\|c$;\6
\&{end};\7
\4\&{function}\1\  \37\\{signed\_quad}: \37\\{integer};\C{returns the next four
bytes, signed}\6
\4\&{var} \37$\|a,\39\|b,\39\|c,\39\|d$: \37\\{eight\_bits};\2\6
\&{begin} \37$\\{read}(\\{gf\_file},\39\|a)$;\5
$\\{read}(\\{gf\_file},\39\|b)$;\5
$\\{read}(\\{gf\_file},\39\|c)$;\5
$\\{read}(\\{gf\_file},\39\|d)$;\5
$\\{cur\_loc}\K\\{cur\_loc}+4$;\6
\&{if} $\|a<128$ \1\&{then}\5
$\\{signed\_quad}\K((\|a\ast256+\|b)\ast256+\|c)\ast256+\|d$\6
\4\&{else} $\\{signed\_quad}\K(((\|a-256)\ast256+\|b)\ast256+\|c)\ast256+\|d$;%
\2\6
\&{end};\par
\fi

\M33. Most info in the \\{oc\_file} comes in words, but we have to write it
as bytes and halfwords occasionally.

\Y\P\D \37$\\{oc\_byte}(\#)\S$\1\6
\&{begin} \37$\\{write}(\\{oc\_file},\39\#)$;\5
$\\{incr}(\\{oc\_byte\_no})$;\6
\&{end}\2\par
\Y\P\4\&{procedure}\1\  \37$\\{oc\_halfword}(\|w:\\{integer})$;\2\6
\&{begin} \37\&{if} $\|w<0$ \1\&{then}\5
$\|w\K\|w+\H{10000}$;\2\6
$\\{oc\_byte}(\|w\mathbin{\&{div}}\H{100})$;\5
$\\{oc\_byte}(\|w\mathbin{\&{mod}}\H{100})$;\6
\&{end};\7
\4\&{procedure}\1\  \37$\\{oc\_word}(\|w:\\{integer})$;\2\6
\&{begin} \37\&{if} $\|w>0$ \1\&{then}\5
$\\{oc\_byte}(\|w\mathbin{\&{div}}\H{1000000})$\6
\4\&{else} \&{begin} \37$\|w\K\|w+\H{40000000}$;\5
$\|w\K\|w+\H{40000000}$;\5
$\\{oc\_byte}((\|w\mathbin{\&{div}}\H{1000000})+128)$;\6
\&{end};\2\6
$\\{oc\_byte}((\|w\mathbin{\&{div}}\H{10000})\mathbin{\&{mod}}\H{100})$;\5
$\\{oc\_byte}((\|w\mathbin{\&{div}}\H{100})\mathbin{\&{mod}}\H{100})$;\5
$\\{oc\_byte}(\|w\mathbin{\&{mod}}\H{100})$;\6
\&{end};\par
\fi

\M34. Simarlarly, most info in the \\{wd\_file} comes in words, but we have to
write it
as bytes and halfwords occasionally.

\Y\P\D \37$\\{wd\_byte}(\#)\S$\1\6
\&{begin} \37$\\{write}(\\{wd\_file},\39\#)$;\5
$\\{incr}(\\{wd\_byte\_no})$;\6
\&{end}\2\par
\Y\P\4\&{procedure}\1\  \37$\\{wd\_halfword}(\|w:\\{integer})$;\2\6
\&{begin} \37\&{if} $\|w<0$ \1\&{then}\5
$\|w\K\|w+\H{10000}$;\2\6
$\\{wd\_byte}(\|w\mathbin{\&{div}}\H{100})$;\5
$\\{wd\_byte}(\|w\mathbin{\&{mod}}\H{100})$;\6
\&{end};\7
\4\&{procedure}\1\  \37$\\{wd\_word}(\|w:\\{integer})$;\2\6
\&{begin} \37\&{if} $\|w>0$ \1\&{then}\5
$\\{wd\_byte}(\|w\mathbin{\&{div}}\H{1000000})$\6
\4\&{else} \&{begin} \37$\|w\K\|w+\H{40000000}$;\5
$\|w\K\|w+\H{40000000}$;\5
$\\{wd\_byte}((\|w\mathbin{\&{div}}\H{1000000})+128)$;\6
\&{end};\2\6
$\\{wd\_byte}((\|w\mathbin{\&{div}}\H{10000})\mathbin{\&{mod}}\H{100})$;\5
$\\{wd\_byte}((\|w\mathbin{\&{div}}\H{100})\mathbin{\&{mod}}\H{100})$;\5
$\\{wd\_byte}(\|w\mathbin{\&{mod}}\H{100})$;\6
\&{end};\par
\fi

\M35. Finally we come to the routines that are used for random access of the
\\{gf\_file}. The driver program below needs two such routines: \\{gf\_length}
should
compute the total number of bytes in \\{gf\_file}, possibly also
causing $\\{eof}(\\{gf\_file})$ to be true; and $\\{move\_to\_byte}(\|n)$
should position \\{gf\_file} so that the next \\{get\_byte} will read byte \|n,
starting with $\|n=0$ for the first byte in the file.

Such routines are, of course, highly system dependent. They are implemented
here in terms of two assumed system routines called \\{set\_pos} and \\{cur%
\_pos}.
The call $\\{set\_pos}(\|f,\|n)$ moves to item \|n in file \|f, unless \|n is
negative or larger than the total number of items in \|f; in the latter
case, $\\{set\_pos}(\|f,\|n)$ moves to the end of file \|f.
The call $\\{cur\_pos}(\|f)$ gives the total number of items in \|f, if
$\\{eof}(\|f)$ is true; we use \\{cur\_pos} only in such a situation.

\Y\P\4\&{function}\1\  \37\\{gf\_length}: \37\\{integer};\2\6
\&{begin} \37$\\{set\_pos}(\\{gf\_file},\39-1)$;\5
$\\{gf\_length}\K\\{cur\_pos}(\\{gf\_file})$;\6
\&{end};\7
\4\&{procedure}\1\  \37$\\{move\_to\_byte}(\|n:\\{integer})$;\2\6
\&{begin} \37$\\{set\_pos}(\\{gf\_file},\39\|n)$;\5
$\\{cur\_loc}\K\|n$;\6
\&{end};\par
\fi

\N36.  Reading the gf information.
The main work of \.{GFDOVER} is accomplished by the \\{do\_char} routine.
This produces the output for an entire character, assuming that the \\{boc}
command for that character has already been processed. This procedure
works in two parts, the first of which is essentially an interpretive
routine that reads and acts on the \.{GF} commands by saving the preamble
and postamble information in tables and by writing the \\{paint} commands
into a condensed two-dimentional array, $\\{paint\_array}[\|y,\\{p\_c}]$, that
can
then be scanned column-by-column reading bottom-to-top to produce the
required \\{oc} raster. This departs from the procedure recommended in
\.{GFTYPE} and it is responsible for a drastic reduction in the operating
time.  We also need to generate a simple array, $\\{paint\_val}[\|y]$, that
reports the color (0 for white and 1 for black) of the first entry in eack
\|y column of the \\{paint\_array}.

Rather than adjusting the size of the \\{paint\_array} to meet the
requirements for each particular glyph, we assign an area large enough to
hold any reasonable sized glyph and arrange to clear only that portion of
the array that is actually used and do this just as the new input
information is being written into the array.

\fi

\M37. The definition of \.{GF} files refers to three registers,
$(x,y,z)$, which hold integer row and column numbers.

\Y\P$\4\X12:Types in the outer block\X\mathrel{+}\S$\6
$\\{x\_coord}=\\{left\_pixel}\to\\{right\_pixel}$;\5
$\\{y\_coord}=\\{bot\_pixel}\to\\{top\_pixel}$;\5
$\\{p\_c\_coord}=0\to\\{max\_p\_c}$;\par
\fi

\M38. \P$\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4$\|x,\39\|z$: \37\\{x\_coord};\6
\4\|y: \37\\{y\_coord};\C{current state values}\6
\4\\{min\_z}: \37\\{x\_coord};\6
\4\\{paint\_switch}: \37\\{pixel};\6
\4\\{paint\_array}: \37\&{array} $[\\{min\_y\_allowed}\to\\{max\_y\_allowed},%
\390\to\\{max\_p\_c}]$ \1\&{of}\5
\\{integer};\2\6
\4\\{paint\_val}: \37\&{array} $[\\{min\_y\_allowed}\to\\{max\_y\_allowed}]$ \1%
\&{of}\5
\\{pixel};\2\6
\4\\{p\_c}: \37\\{p\_c\_coord};\C{used as second coordinate in \\{paint%
\_array}}\par
\fi

\M39. In place of the recommended large array of pixels to hold the character
image.
we use an array called \\{paint\_array} of dimensions
$\\{max\_y\_allowed}+1-\\{min\_y\_allowed}$ and $\\{max\_p\_c\_allowed}+1$
to hold the yet to be interpreted paint commands
and a \\{paint\_val} of dimensions $\\{max\_y\_allowed}+1-\\{min\_y\_allowed}$
to
hold the current paint values (black or white) for the \|y row that is
next to be written out.

\Y\P\D \37$\\{p\_array}\S\\{paint\_array}[\|y,\39\\{p\_c}]$\par
\P\D \37$\\{p\_val}\S\\{paint\_val}[\|y]$\par
\P\D \37$\\{white}\S0$\C{could also be \\{false}}\par
\P\D \37$\\{black}\S1$\C{could also be \\{true}}\par
\P\D \37$\\{complement}(\#)\S$\1\6
\&{if} $\#=\\{black}$ \1\&{then}\5
$\#\K\\{white}$\ \&{else} $\#\K\\{black}$\2\2\par
\Y\P$\4\X12:Types in the outer block\X\mathrel{+}\S$\6
$\\{pixel}=\\{white}\to\\{black}$;\C{could also be \\{boolean}}\par
\fi

\M40. Let's keep track of how many characters are in the font, and the
locations of where each one occured in the file.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{total\_chars}: \37\\{integer};\C{the total number of characters seen so
far}\6
\4\\{char\_ptr}: \37\&{array} $[0\to255]$ \1\&{of}\5
\\{integer};\C{correct character location pointer}\2\6
\4\\{gf\_prev\_ptr}: \37\\{integer};\C{\\{char\_ptr} for next character}\6
\4\\{char\_code}: \37\\{integer};\C{current character number}\par
\fi

\M41. \P$\X15:Set initial values\X\mathrel{+}\S$\6
\&{for} $\|i\K0\mathrel{\&{to}}\\{max\_glyph\_no}$ \1\&{do}\5
$\\{char\_ptr}[\|i]\K-1$;\C{mark characters as not being in the file}\2\6
$\\{total\_chars}\K0$;\par
\fi

\M42. Before we get into the details of \\{do\_char}, it is convenient to
consider a simpler routine that computes the first parameter of each
opcode.

\Y\P\D \37$\\{three\_cases}(\#)\S\#,\39\#+1,\39\#+2$\par
\P\D \37$\\{four\_cases}(\#)\S\#,\39\#+1,\39\#+2,\39\#+3$\par
\P\D \37$\\{eight\_cases}(\#)\S\\{four\_cases}(\#),\39\\{four\_cases}(\#+4)$\par
\P\D \37$\\{nine\_cases}(\#)\S\\{eight\_cases}(\#),\39\#+8$\par
\P\D \37$\\{sixteen\_cases}(\#)\S\\{eight\_cases}(\#),\39\\{eight\_cases}(%
\#+8)$\par
\P\D \37$\\{nineteen\_cases}(\#)\S\\{nine\_cases}(\#),\39\\{nine\_cases}(\#+9),%
\39\#+18$\par
\P\D \37$\\{thirty\_two\_cases}(\#)\S\\{sixteen\_cases}(\#),\39\\{sixteen%
\_cases}(\#+16)$\par
\P\D \37$\\{sixty\_four\_cases}(\#)\S\\{thirty\_two\_cases}(\#),\39\\{thirty%
\_two\_cases}(\#+32)$\par
\P\D \37$\\{eighty\_three\_cases}(\#)\S\\{sixty\_four\_cases}(\#),\39%
\\{nineteen\_cases}(\#+64)$\par
\Y\P\4\&{function}\1\  \37$\\{first\_par}(\|o:\\{eight\_bits})$: \37%
\\{integer};\2\6
\&{begin} \37\&{case} $\|o$ \1\&{of}\6
\4$\\{sixty\_four\_cases}(\\{paint\_0})$: \37$\\{first\_par}\K\|o-\\{paint%
\_0}$;\6
\4$\\{paint1},\39\\{skip1},\39\\{char\_loc},\39\\{xxx1}$: \37$\\{first\_par}\K%
\\{get\_byte}$;\6
\4$\\{paint1}+1,\39\\{skip1}+1,\39\\{xxx1}+1$: \37$\\{first\_par}\K\\{get\_two%
\_bytes}$;\6
\4$\\{paint1}+2,\39\\{skip1}+2,\39\\{xxx1}+2$: \37$\\{first\_par}\K\\{get%
\_three\_bytes}$;\6
\4$\\{new\_row},\39\\{xxx1}+3,\39\\{yyy}$: \37$\\{first\_par}\K\\{signed%
\_quad}$;\6
\4$\\{nop},\39\\{boc},\39\\{eoc},\39\\{pre},\39\\{post},\39\\{post\_post},\39%
\\{undefined\_commands}$: \37$\\{first\_par}\K0$;\6
\4$\\{eighty\_three\_cases}(\\{left\_z\_83}),\39\\{right\_z\_0},\39\\{eighty%
\_three\_cases}(\\{right\_z\_1})$: \37$\\{first\_par}\K\|o-\\{right\_z\_0}$;\2\6
\&{end};\6
\&{end};\par
\fi

\M43. Strictly speaking, the \\{do\_char} procedure is really a function with
side effects, not a `\&{procedure}'\thinspace; it returns the value \\{false}
if \.{GFtype} should be aborted because of some unusual happening. The
subroutine is organized as a typical interpreter, with a multiway branch
on the command code.

\Y\P\4\&{function}\1\  \37\\{do\_char}: \37\\{boolean};\6
\4\&{label} \37$9998,\399999$;\6
\4\&{var} \37\|o: \37\\{eight\_bits};\C{operation code of the current command}\6
$\|p,\39\|q$: \37\\{integer};\C{parameters of the current command}\6
$\|i,\39\|j$: \37\\{integer};\C{used as indices}\6
\|b: \37\\{eight\_bits};\C{holding byte for oc bits}\2\6
\&{begin} \37\C{we've already scanned the \\{boc}}\6
$\\{do\_char}\K\\{true}$;\6
\&{while} $\\{true}$ \1\&{do}\5
\X44:Translate the next command in the \.{GF} file; \&{goto} 9999 if it was %
\\{eoc}; \&{goto} 9998 if premature termination is needed\X;\2\6
\49998: \37$\\{print\_ln}(\.{\'!\'})$;\5
$\\{do\_char}\K\\{false}$;\6
\49999: \37\&{end};\par
\fi

\M44. \P\D \37$\\{show\_label}(\#)\S\\{print}(\|a:1,\39\.{\':\ \'},\39\#)$\par
\P\D \37$\\{error}(\#)\S$\1\6
\&{begin} \37$\\{show\_label}(\.{\'!\ \'},\39\#)$;\5
\\{print\_nl};\6
\&{end}\2\par
\P\D \37$\\{start\_op}\S\|a\K\\{cur\_loc}$;\5
$\|o\K\\{get\_byte}$;\5
$\|p\K\\{first\_par}(\|o)$;\6
\&{if} $\\{eof}(\\{gf\_file})$ \1\&{then}\5
$\\{bad\_gf}(\.{\'the\ file\ ended\ prematurely\'})$\2\par
\Y\P$\4\X44:Translate the next command in the \.{GF} file; \&{goto} 9999 if it
was \\{eoc}; \&{goto} 9998 if premature termination is needed\X\S$\6
\&{begin} \37\\{start\_op};\5
\X46:Start translation of command \|o and \&{goto}  the appropriate label to
finish the job\X;\6
\&{end}\par
\U section~43.\fi

\N45.  Translating the input commands.  This section will be largely concerned
with
the reading of the input commands and the storing of this information in a
convenient form for future use.

\fi

\M46. The multiway switch in \\{first\_par}, above, was organized by the length
of each command; the one in \\{do\_char} is organized by the semantics.

\Y\P$\4\X46:Start translation of command \|o and \&{goto}  the appropriate
label to finish the job\X\S$\6
\&{if} $\|o\L\\{paint1}+3$ \1\&{then}\5
\X51:Translate a sequence of \\{paint} commands, until reaching a non-\\{paint}%
\X;\2\6
\&{if} $(\\{new\_row}\L\|o)\W(\|o\L\\{right\_z\_83})$ \1\&{then}\5
\X53:Translate a \\{new\_row}, \\{right} or \\{left} command\X\6
\4\&{else} \&{case} $\|o$ \1\&{of}\6
\4$\\{three\_cases}(\\{skip1})$: \37\X54:Translate a \\{skip} command\X;\6
\hbox{\4}\X47:Cases for commands \\{nop}, \\{pre}, \\{post}, \\{post\_post}, %
\\{boc}, and \\{eoc}\X\6
\4$\\{four\_cases}(\\{xxx1})$: \37\X48:Translate an \\{xxx} command\X;\6
\4\\{yyy}: \37\X50:Translate a \\{yyy} command\X;\6
\4\&{othercases} \37$\\{error}(\.{\'undefined\ command\ \'},\39\|o:1,\39\.{\'!%
\'})$\2\6
\&{endcases}\2\par
\U section~44.\fi

\M47. \P$\X47:Cases for commands \\{nop}, \\{pre}, \\{post}, \\{post\_post}, %
\\{boc}, and \\{eoc}\X\S$\6
\4\\{nop}: \37\\{do\_nothing};\6
\4\\{pre}: \37\&{begin} \37$\\{error}(\.{\'preamble\ command\ within\ a\
character!\'})$;\5
\&{goto} \379998;\6
\&{end};\6
\4$\\{post},\39\\{post\_post}$: \37\&{begin} \37$\\{error}(\.{\'postamble\
command\ within\ a\ character!\'})$;\5
\&{goto} \379998;\6
\&{end};\6
\4\\{boc}: \37\&{begin} \37$\\{error}(\.{\'boc\ occurred\ before\ eoc!\'})$;\5
\&{goto} \379998;\6
\&{end};\6
\4\\{eoc}: \37\&{begin} \37\C{\\{print\_nl};}\6
\&{goto} \379999;\6
\&{end};\par
\U section~46.\fi

\M48. \P$\X48:Translate an \\{xxx} command\X\S$\6
\&{begin} \37$\\{bad\_char}\K\\{false}$;\5
$\|n\K16$;\6
\&{if} $\|p<0$ \1\&{then}\5
$\\{error}(\.{\'string\ of\ negative\ length!\'})$;\2\6
\&{while} $\|p>0$ \1\&{do}\6
\&{begin} \37$\|q\K\\{get\_byte}$;\6
\&{if} $(\|q<\.{"\ "})\V(\|q>\.{"\~"})$ \1\&{then}\5
$\\{bad\_char}\K\\{true}$;\2\6
$\\{decr}(\|p)$;\6
\&{end};\2\6
\&{if} $\\{bad\_char}$ \1\&{then}\5
$\\{error}(\.{\'non-ASCII\ character\ in\ xxx\ command!\'})$;\2\6
\&{end}\par
\U sections~46 and~83.\fi

\M49. \P$\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{bad\_char}: \37\\{boolean};\C{has a non-ASCII character code appeared in
this \\{xxx}?}\6
\4\\{n\_r\_flag}: \37\\{boolean};\C{has a \\{newrow} command just been
executed?}\par
\fi

\M50. \P$\X50:Translate a \\{yyy} command\X\S$\6
\&{begin} \37\&{end}\par
\U sections~46 and~83.\fi

\M51. The bulk of a \.{GF} file generally consists of \\{paint} commands,
so we collect them together and store the extracted information in
the appropiate locations in the \\{paint\_array}.

\Y\P$\4\X51:Translate a sequence of \\{paint} commands, until reaching a non-%
\\{paint}\X\S$\6
\&{begin} \37$\\{n\_r\_flag}\K\\{false}$;\6
\1\&{repeat} \37\X52:Store it away\X;\6
\\{start\_op};\6
\4\&{until}\5
$\|o>\\{paint1}+3$;\2\6
\&{end}\par
\U section~46.\fi

\M52. \P$\X52:Store it away\X\S$\6
$\\{p\_array}\K\|p$;\5
$\\{incr}(\\{p\_c})$;\5
$\\{p\_array}\K0$;\6
\&{if} $\|p>0$ \1\&{then}\6
\&{begin} \37\&{if} $\|y>\\{max\_y\_observed}$ \1\&{then}\5
$\\{max\_y\_observed}\K\|y$;\2\6
\&{if} $\|y<\\{min\_y\_observed}$ \1\&{then}\5
$\\{min\_y\_observed}\K\|y$;\2\6
$\|l\K\|x$;\5
$\|r\K\|x+\|p-1$;\6
\&{if} $\|r>\\{max\_x\_observed}$ \1\&{then}\5
$\\{max\_x\_observed}\K\|r$;\2\6
\&{if} $\|l<\\{min\_x\_observed}$ \1\&{then}\5
$\\{min\_x\_observed}\K\|l$;\2\6
$\|x\K\|r+1$;\6
\&{end};\2\par
\U section~51.\fi

\M53. \P$\X53:Translate a \\{new\_row}, \\{right} or \\{left} command\X\S$\6
\&{begin} \37$\\{n\_r\_flag}\K\\{true}$;\5
$\\{decr}(\|y)$;\5
$\|z\K\|z+\|p$;\5
$\|x\K\|z$;\6
\&{if} $\|z<\\{min\_z}$ \1\&{then}\5
$\\{min\_z}\K\|z$;\2\6
$\\{p\_c}\K0$;\6
\&{if} $\|z>0$ \1\&{then}\6
\&{begin} \37$\\{p\_val}\K\\{white}$;\5
$\\{p\_array}\K\|z$;\5
$\\{incr}(\\{p\_c})$;\5
$\\{p\_array}\K0$;\C{to clear the next \\{p\_c} location}\6
\&{end}\6
\4\&{else} $\\{p\_val}\K\\{black}$;\2\6
\&{end}\par
\U section~46.\fi

\M54. \P$\X54:Translate a \\{skip} command\X\S$\6
\&{begin} \37$\|p\K\|p+1$;\5
\\{print\_nl};\5
$\\{print}(\.{\'corrected\ p\ value\ =\ \'},\39\|p:1)$;\6
\&{if} $\\{n\_r\_flag}=\\{true}$ \1\&{then}\6
\&{begin} \37$\\{paint\_val}[\|y-\|p]\K\\{p\_val}$;\5
$\\{paint\_array}[\|y-\|p,\390]\K\\{paint\_array}[\|y,\390]$;\5
$\\{paint\_array}[\|y-\|p,\391]\K\\{paint\_array}[\|y,\391]$;\5
$\\{incr}(\|y)$;\6
\&{end};\2\6
\&{while} $\|p>0$ \1\&{do}\6
\&{begin} \37$\\{decr}(\|y)$;\5
$\\{p\_val}\K\\{white}$;\5
$\\{paint\_array}[\|y,\390]\K0$;\5
$\\{decr}(\|p)$;\6
\&{end};\2\6
$\\{decr}(\|y)$;\6
\&{end}\par
\U section~46.\fi

\M55. We will have to make some calculations in floating point and convert the
results to integers.

\Y\P\4\&{function}\1\  \37$\\{phys\_size}(\|i:\\{integer})$: \37\\{integer};\6
\4\&{var} \37\|r: \37\\{real};\2\6
\&{begin} \37$\|r\K(\|i\ast\\{magnification}\ast2540/\\{ppi})+0.5$;\5
$\\{phys\_size}\K\\{round}(\|r)$;\6
\&{end};\par
\fi

\M56. Still another procedure will soon be
needed to move the saved material from \\{wd\_file} to the \\{oc\_file}.

\Y\P\4\&{procedure}\1\  \37\\{move\_rasters};\6
\4\&{var} \37\|b: \37\\{eight\_bits};\2\6
\&{begin} \37\\{reopen\_wd\_file};\5
$\|b\K0$;\6
\&{while} $\R\\{eof}(\\{wd\_file})$ \1\&{do}\6
\&{begin} \37$\\{read}(\\{wd\_file},\39\|b)$;\5
$\\{oc\_byte}(\|b)$;\6
\&{end};\2\6
$\\{close}(\\{wd\_file})$;\5
\\{open\_wd\_file};\C{rewrite in preparation for \\{wd} info}\6
\&{end};\par
\fi

\M57. We may have occasion to tabulate the \\{p\_array} information for
debugging.

\Y\P\4\&{procedure}\1\  \37\\{tabulate};\6
\4\&{var} \37\|y: \37\\{integer};\2\6
\&{begin} \37$\\{print\_ln}(\.{\'Tabulated\ results\'})$;\5
$\|y\K\\{max\_y\_observed}$;\6
\&{while} $\|y\G\\{min\_y\_observed}$ \1\&{do}\6
\&{begin} \37$\\{p\_c}\K0$;\5
\\{print\_nl};\5
$\\{print}(\|y:3)$;\6
\&{if} $\\{p\_val}=0$ \1\&{then}\5
$\\{print}(\.{\'w\'}:3)$\6
\4\&{else} $\\{print}(\.{\'b\'}:3)$;\2\6
\&{while} $\\{p\_array}>0$ \1\&{do}\6
\&{begin} \37$\\{print}(\\{p\_array}:4)$;\5
$\\{incr}(\\{p\_c})$;\6
\&{end};\2\6
$\\{decr}(\|y)$;\6
\&{end};\2\6
\\{print\_nl};\5
$\\{print}(\.{\'End\ of\ tabulated\ results\'})$;\5
$\\{p\_c}\K0$;\6
\&{end};\par
\fi

\N58.  Processing and writing out the raster information.
As noted earlier, we will write the \\{oc} raster information into the
\\{wd\_file} initially so the routines will refer to thd \\{wd\_file} but it is
well to remember that it is actually \\{oc\_file} information that is being
put away for safe keeping.

\fi

\M59. Before storing the raster information we will want to remove any existing
all-white columns at the left of the glyph.

\Y\P$\4\X59:Remove blank columns at the left\X\S$\6
$\\{min\_y}\K\\{min\_y\_stated}$;\5
$\\{max\_y}\K\\{max\_y\_stated}$;\6
\&{if} $\\{min\_z}>0$ \1\&{then}\6
\&{begin} \37$\\{min\_x}\K\\{min\_x\_stated}+\\{min\_z}$;\5
$\|y\K\\{min\_y}$;\5
$\\{p\_c}\K0$;\6
\&{while} $\|y\L\\{max\_y}$ \1\&{do}\6
\&{begin} \37\&{if} $\\{p\_array}\I0$ \1\&{then}\C{consider only non-blank
rows}\6
\&{begin} \37$\\{p\_array}\K\\{p\_array}-\\{min\_z}$;\6
\&{if} $\\{p\_array}=0$ \1\&{then}\6
\&{begin} \37$\\{p\_val}\K\\{black}$;\5
$\\{p\_array}\K\\{paint\_array}[\|y,\391]$;\5
$\\{p\_c}\K1$;\6
\&{while} $\\{p\_array}\I0$ \1\&{do}\6
\&{begin} \37$\\{p\_array}\K\\{paint\_array}[\|y,\39\\{p\_c}+1]$;\5
$\\{incr}(\\{p\_c})$;\6
\&{end};\2\6
$\\{p\_c}\K0$;\6
\&{end};\2\6
\&{end};\2\6
$\\{incr}(\|y)$;\6
\&{end};\2\6
\&{end};\2\par
\U section~82.\fi

\M60. We will also want to correct the value of \\{max\_x} to define the actual
bounding box for the glyph as required by the \\{oc} format.

\Y\P$\4\X60:Establish new value of \\{max\_x}\X\S$\6
$\\{max\_x}\K\\{min\_x}$;\5
$\|y\K\\{max\_y}$;\6
\&{while} $\|y\G\\{min\_y}$ \1\&{do}\6
\&{begin} \37$\|c\K\\{min\_x}$;\5
$\\{p\_c}\K0$;\6
\&{while} $\\{p\_array}>0$ \1\&{do}\6
\&{begin} \37$\|c\K\|c+\\{p\_array}$;\5
$\\{incr}(\\{p\_c})$;\6
\&{end};\2\6
\&{if} $\|c>\\{max\_x}$ \1\&{then}\5
$\\{max\_x}\K\|c$;\2\6
$\\{decr}(\|y)$;\6
\&{end};\2\6
\\{print\_nl};\5
$\\{print}(\.{\'new\ min\_x=\ \'},\39\\{min\_x}:1)$;\5
$\\{print}(\.{\'\ \ new\ max\_x=\ \'},\39\\{max\_x}:1)$;\par
\U section~82.\fi

\M61. We will not normally expect to encounter \\{skip} instructions between a
\\{boc} command and the first \\{paint} command or between the last \\{paint}
command and an \\{eoc} command, but should they occur, we will want to
ignore the blank rows that they produce in defining the bounding box as
used for the \\{oc} formulation.

\Y\P$\4\X61:Remove blank rows from top and bottom\X\S$\6
$\|y\K\\{max\_y}$;\5
$\\{p\_c}\K0$;\6
\&{while} $(\\{p\_array}=0)\W(\|y>\\{min\_y})$ \1\&{do}\6
\&{begin} \37$\\{decr}(\|y)$;\5
$\\{max\_y}\K\|y$;\C{remove blank rows at the top}\6
\&{end};\2\6
$\|y\K\\{min\_y}$;\6
\&{while} $(\\{p\_array}=0)\W(\|y<\\{max\_y})$ \1\&{do}\6
\&{begin} \37$\\{incr}(\|y)$;\5
$\\{min\_y}\K\|y$;\C{remove blank rows at the bottom}\6
\&{end};\2\6
\\{print\_nl};\5
$\\{print}(\.{\'new\ min\_y=\ \'},\39\\{min\_y}:1)$;\5
$\\{print}(\.{\'\ \ new\ max\_y=\ \'},\39\\{max\_y}:1)$;\5
\\{print\_nl};\par
\U section~82.\fi

\M62. By this time we will have accumulated some information needed for
the \\{oc} preamble.

\Y\P$\4\X62:Save data for the \\{oc} file\X\S$\6
$\\{glyph\_cols}[\\{char\_code}]\K\\{max\_x}+1-\\{min\_x}$;\5
$\\{glyph\_rows}[\\{char\_code}]\K\\{max\_y}+1-\\{min\_y}$;\5
$\\{min\_x\_array}[\\{char\_code}]\K\\{min\_x}$;\5
$\\{min\_y\_array}[\\{char\_code}]\K\\{min\_y}$;\par
\U section~82.\fi

\M63. When edges are encountered while writing out the raster information, we
will find it convenient to call the following procedure in order to
complement the appropriate value of \\{p\_val} and to move
the entries in \\{paint\_array} so as to remove the exhausted paint entry,

\Y\P\4\&{procedure}\1\  \37\\{fix\_val};\2\6
\&{begin} \37$\\{complement}(\\{p\_val})$;\6
\&{while} $\\{p\_array}>0$ \1\&{do}\6
\&{begin} \37$\\{p\_array}\K\\{paint\_array}[\|y,\39\\{p\_c}+1]$;\5
$\\{incr}(\\{p\_c})$;\6
\&{end};\2\6
$\\{p\_c}\K0$;\6
\&{end};\par
\fi

\M64. We define the earliest raster position in the \\{oc} file to be '3000 (in
16-bit words) rounded up to the nearest multiple of 2*pagesizes (for
WAITS' sake).

\Y\P$\4\X5:Constants in the outer block\X\mathrel{+}\S$\6
$\\{char\_seg\_file\_pos}=1536$;\C{halfword where raster information is to
start}\par
\fi

\M65. The following routine writes out the intended
\\{oc} raster, initially on the \\{wd\_file}, while
observing the file position restriction just noted in recording the
\\{glyph\_ptr} value.

\Y\P$\4\X65:Write the \\{oc} raster\X\S$\6
\&{if} $\\{glyph\_ptr}[\\{char\_code}]\I-1$ \1\&{then}\5
$\\{error}(\.{\'Duplicate\ glyph\'})$;\2\6
$\\{glyph\_ptr}[\\{char\_code}]\K\\{wd\_byte\_no}\mathbin{\&{div}}2+\\{char%
\_seg\_file\_pos}$;\5
$\|x\K\\{min\_x}$;\5
$\|y\K\\{min\_y}$;\5
$\\{p\_c}\K0$;\6
\&{while} $\|y\L\\{max\_y}$ \1\&{do}\6
\&{begin} \37$\|b\K\\{p\_val}$;\6
\&{if} $\\{p\_array}>1$ \1\&{then}\5
$\\{decr}(\\{p\_array})$\6
\4\&{else} \&{if} $\\{p\_array}=1$ \1\&{then}\5
\\{fix\_val};\2\2\6
$\\{incr}(\|y)$;\5
$\|i\K2$;\6
\&{if} $\|y<(\\{max\_y}-6)$ \1\&{then}\5
\X66:Get full byte\X\6
\4\&{else} \X67:Get mixed byte\X;\2\6
$\\{wd\_byte}(\|b)$;\6
\&{end};\2\6
\&{if} $(\\{wd\_byte\_no}\mathbin{\&{mod}}2)\I0$ \1\&{then}\5
$\\{wd\_byte}(0)$;\2\par
\U section~82.\fi

\M66. \P$\X66:Get full byte\X\S$\6
\&{begin} \37\&{while} $\|i\L8$ \1\&{do}\6
\&{begin} \37$\|b\K\|b\ast2+\\{p\_val}$;\6
\&{if} $\\{p\_array}>1$ \1\&{then}\5
$\\{decr}(\\{p\_array})$\6
\4\&{else} \&{if} $\\{p\_array}=1$ \1\&{then}\5
\\{fix\_val};\2\2\6
$\\{incr}(\|y)$;\5
$\\{incr}(\|i)$;\6
\&{end};\2\6
\&{if} $(\|y>\\{max\_y})\W(\|x<\\{max\_x})$ \1\&{then}\6
\&{begin} \37$\\{incr}(\|x)$;\5
$\|y\K\\{min\_y}$;\6
\&{end};\2\6
\&{end}\par
\U section~65.\fi

\M67. \P$\X67:Get mixed byte\X\S$\6
\&{begin} \37\&{while} $\|y\L\\{max\_y}$ \1\&{do}\6
\&{begin} \37$\|b\K\|b\ast2+\\{p\_val}$;\6
\&{if} $\\{p\_array}>1$ \1\&{then}\5
$\\{decr}(\\{p\_array})$\6
\4\&{else} \&{if} $\\{p\_array}=1$ \1\&{then}\5
\\{fix\_val};\2\2\6
$\\{incr}(\|y)$;\5
$\\{incr}(\|i)$;\6
\&{end};\2\6
\&{if} $\|x<\\{max\_x}$ \1\&{then}\6
\&{begin} \37$\|y\K\\{min\_y}$;\5
$\\{incr}(\|x)$;\6
\&{while} $\|i\L8$ \1\&{do}\6
\&{begin} \37$\|b\K\|b\ast2+\\{p\_val}$;\6
\&{if} $\\{p\_array}>1$ \1\&{then}\5
$\\{decr}(\\{p\_array})$\6
\4\&{else} \&{if} $\\{p\_array}=1$ \1\&{then}\5
\\{fix\_val};\2\2\6
$\\{incr}(\|y)$;\5
$\\{incr}(\|i)$;\6
\&{end};\2\6
\&{end}\6
\4\&{else} \&{begin} \37\&{while} $\|i\L8$ \1\&{do}\6
\&{begin} \37$\|b\K\|b\ast2$;\5
$\\{incr}(\|i)$;\6
\&{end};\2\6
\&{end};\2\6
\&{end}\par
\U section~65.\fi

\N68.  Reading the postamble.
Now imagine that we are reading the \.{GF} file and positioned just
after the \\{post} command. That, in fact, is the situation,
when the following part of \.{GFDOVER} is called upon to read, translate,
and check the rest of the postamble.

\Y\P\4\&{procedure}\1\  \37\\{read\_postamble};\6
\4\&{var} \37\|k: \37\\{integer};\C{loop index}\6
$\|p,\39\|q,\39\|m,\39\|c$: \37\\{integer};\C{general purpose registers}\2\6
\&{begin} \37$\\{post\_loc}\K\\{cur\_loc}-1$;\5
$\|p\K\\{signed\_quad}$;\5
$\\{design\_size}\K\\{signed\_quad}$;\5
$\\{check\_sum}\K\\{signed\_quad}$;\6
$\\{print}(\.{\'design\ size\ =\ \'},\39\\{design\_size}:1,\39\.{\'\ (\'})$;\5
$\\{print\_scaled}(\\{design\_size}\mathbin{\&{div}}16)$;\5
$\\{print\_ln}(\.{\')\'})$;\5
$\\{print\_ln}(\.{\'check\ sum\ =\ \'},\39\\{check\_sum}:1)$;\6
$\\{hppp}\K\\{signed\_quad}$;\5
$\\{vppp}\K\\{signed\_quad}$;\6
$\\{print}(\.{\'hppp\ =\ \'},\39\\{hppp}:1,\39\.{\'\ (\'})$;\5
$\\{print\_scaled}(\\{hppp})$;\5
$\\{print\_ln}(\.{\')\'})$;\5
$\\{print}(\.{\'vppp\ =\ \'},\39\\{vppp}:1,\39\.{\'\ (\'})$;\5
$\\{print\_scaled}(\\{vppp})$;\5
$\\{print\_ln}(\.{\')\'})$;\5
$\\{magnification}\K\\{hppp}/(65536.0\ast\\{resolution}/72.27)$;\5
$\\{oc\_mag}\K\\{round}(1000\ast\\{magnification})$;\5
$\\{print\_ln}(\.{\'mag\ =\ \'},\39\\{oc\_mag}:1)$;\5
$\\{min\_x}\K\\{signed\_quad}$;\5
$\\{max\_x}\K\\{signed\_quad}$;\5
$\\{min\_y}\K\\{signed\_quad}$;\5
$\\{max\_y}\K\\{signed\_quad}$;\6
$\\{print\_ln}(\.{\'min\ x\ =\ \'},\39\\{min\_x}:1,\39\.{\',\ max\ x\ =\ \'},%
\39\\{max\_x}:1)$;\6
$\\{print\_ln}(\.{\'min\ y\ =\ \'},\39\\{min\_y}:1,\39\.{\',\ max\ y\ =\ \'},%
\39\\{max\_y}:1)$;\6
\X71:Process the character locations in the postamble\X;\6
\X70:Make sure that the end of the file is well-formed\X;\6
\&{end};\par
\fi

\M69. Here is the main information we glean from the postamble together with
some auxiliary parameters.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{design\_size}: \37\\{integer};\6
\4$\\{hppp},\39\\{vppp}$: \37\\{integer};\6
\4\\{check\_sum}: \37\\{integer};\6
\4\\{post\_loc}: \37\\{integer};\6
\4\\{magnification}: \37\\{real};\6
\4\\{tfm\_width}: \37\&{array} $[0\to\\{max\_glyph\_no}]$ \1\&{of}\5
\\{integer};\2\6
\4\\{device\_width}: \37\&{array} $[0\to\\{max\_glyph\_no}]$ \1\&{of}\5
\\{integer};\2\6
\4$\\{min\_x},\39\\{max\_x},\39\\{min\_y},\39\\{max\_y}$: \37\\{integer};%
\C{bounds of the current subarray}\6
\4$\\{min\_x\_stated},\39\\{max\_x\_stated},\39\\{min\_y\_stated},\39\\{max\_y%
\_stated}$: \37\\{integer};\C{bounds stated in the \.{GF} file}\6
\4$\\{min\_x\_observed},\39\\{max\_x\_observed},\39\\{min\_y\_observed},\39%
\\{max\_y\_observed}$: \37\\{integer};\C{bounds actually observed when
painting}\6
\4$\\{min\_x\_overall},\39\\{max\_x\_overall},\39\\{min\_y\_overall},\39\\{max%
\_y\_overall}$: \37\\{integer};\C{bounds observed in the entire file so far}\par
\fi

\M70. When we get to the present code, the \\{post\_post} command has
just been read.

\Y\P$\4\X70:Make sure that the end of the file is well-formed\X\S$\6
\&{if} $\|k\I\\{post\_post}$ \1\&{then}\5
$\\{error}(\.{\'should\ be\ postpost!\'})$;\2\6
$\|q\K\\{signed\_quad}$;\6
\&{if} $\|q\I\\{post\_loc}$ \1\&{then}\5
$\\{error}(\.{\'postamble\ pointer\ should\ be\ \'},\39\\{post\_loc}:1,\39\.{\'%
\ not\ \'},\39\|q:1)$;\2\6
$\|m\K\\{get\_byte}$;\6
\&{if} $\|m\I\\{gf\_id\_byte}$ \1\&{then}\5
$\\{error}(\.{\'identification\ byte\ should\ be\ \'},\39\\{gf\_id\_byte}:1)$;%
\2\6
$\|k\K\\{cur\_loc}$;\5
$\|m\K223$;\6
\&{while} $(\|m=223)\W\R\\{eof}(\\{gf\_file})$ \1\&{do}\5
$\|m\K\\{get\_byte}$;\2\6
\&{if} $\R\\{eof}(\\{gf\_file})$ \1\&{then}\5
$\\{bad\_gf}(\.{\'signature\ in\ byte\ \'},\39\\{cur\_loc}-1:1,\39\.{\'\ should%
\ be\ 223\'})$\6
\4\&{else} \&{if} $\\{cur\_loc}<\|k+4$ \1\&{then}\5
$\\{error}(\.{\'not\ enough\ signature\ bytes\ at\ end\ of\ file\'})$;\2\2\par
\U section~68.\fi

\M71. \P$\X71:Process the character locations in the postamble\X\S$\6
\1\&{repeat} \37$\|k\K\\{get\_byte}$;\6
\&{if} $\|k=\\{char\_loc}$ \1\&{then}\6
\&{begin} \37$\|c\K\\{first\_par}(\|k)$;\6
\&{if} $\|c>\\{max\_glyph\_no}$ \1\&{then}\5
$\\{abort}(\.{\'Character\ number\ too\ large\'})$;\2\6
$\\{device\_width}[\|c]\K\\{signed\_quad}$;\5
$\\{tfm\_width}[\|c]\K\\{signed\_quad}$;\6
\&{if} $\\{tfm\_width}[\|c]<\\{tfm\_min}$ \1\&{then}\5
$\\{tfm\_min}\K\\{tfm\_width}[\|c]$;\2\6
\&{if} $\\{tfm\_width}[\|c]>\\{tfm\_max}$ \1\&{then}\5
$\\{tfm\_max}\K\\{tfm\_width}[\|c]$;\2\6
$\|p\K\\{signed\_quad}$;\5
$\|k\K\\{nop}$;\6
\&{end};\2\6
\4\&{until}\5
$\|k\I\\{nop}$;\2\par
\U section~68.\fi

\M72. This routines is brought into play in order to read the postamble first.

\Y\P\4\&{procedure}\1\  \37\\{find\_postamble};\6
\4\&{var} \37$\|q,\39\|k$: \37\\{integer};\2\6
\&{begin} \37$\\{post\_loc}\K\\{gf\_length}-4$;\6
\1\&{repeat} \37\&{if} $\\{post\_loc}=0$ \1\&{then}\5
$\\{bad\_gf}(\.{\'all\ 223s\'})$;\2\6
$\\{move\_to\_byte}(\\{post\_loc})$;\5
$\|k\K\\{get\_byte}$;\5
$\\{decr}(\\{post\_loc})$;\6
\4\&{until}\5
$\|k\I223$;\2\6
\&{if} $\|k\I\\{gf\_id\_byte}$ \1\&{then}\5
$\\{bad\_gf}(\.{\'ID\ byte\ is\ \'},\39\|k:1)$;\2\6
$\\{move\_to\_byte}(\\{post\_loc}-3)$;\5
$\|q\K\\{signed\_quad}$;\6
\&{if} $(\|q<0)\V(\|q>\\{post\_loc}-3)$ \1\&{then}\5
$\\{bad\_gf}(\.{\'post\ pointer\ \'},\39\|q:1,\39\.{\'\ at\ byte\ \'},\39%
\\{post\_loc}-3:1)$;\2\6
$\\{move\_to\_byte}(\|q)$;\5
$\|k\K\\{get\_byte}$;\6
\&{if} $\|k\I\\{post}$ \1\&{then}\5
$\\{bad\_gf}(\.{\'byte\ \'},\39\|q:1,\39\.{\'\ is\ not\ post\'})$;\2\6
\&{end};\par
\fi

\N73.  OC File Format.
An \.{OC} file is an expanded raster description of a single font at a
particular resolution and contains only a portion of the information
that is contained in a \.{GF} file.  \.{OC} files are used by the Dover.
All words in of \.{OC} files are in 32-bit format, with the four lower
bits zero on 36-bit machines.

By convention, \.{OC} files are for 384 pixels per inch. \.{GFDOVER} will
report the magnification over the design point size that will occur if the
\.{OC} file is used on a 384 pixel per inch output device. Fonts
specifically designed for the Dover will report a magnification of 1000.

Data segments of type OrbitChars have an internal structure that is a
minature version of the structure of the complete dictionary file.  The
file begins with some general infomation about the font in general.  Then
there is a table that specifies the dimensions and widths of each
character in the font. Next there is a table of file pointers that give,
for each character code, the location of the corresponding raster block.
And finally, there are the raster blocks themselves.


The raster information is contained in a sequence of binary words that
record white pixels as zeros and black pixels as ones. Furthermore, this
raster information is written in a rotated form, as compared with the
convention for \.{PXL} files, reporting the pixels as read from the bottom
left corner of the glyph, reading up the leftmost column, with this being
followed imediately by the next column, again from bottom to top, without
any unused bit locations between columns. The final half word is, however
padded out with zeros.

Since the details of the header information for the \.{.OC} file cannot be
known until most of the work has been done toward creating the raster
information itself, the \.{OC} format arranges for the raster information
to start at byte '3000.  Originally the \.{OC} portion of \.{MF} was
designed to write zeros in the first '3000 bytes, then to procede to write
the raster information, one glyph at a time, and save the necessary header
information in global arrays, and only after the last glyph has been
processed, to then write out the header.  While this routine is easy to
follow in programs written in SAIL, it is difficult and indeed virtually
impossible with the simplified form of \.{PASCAL} as used in this program.

We therefore adopt an easier course, that of saving the \.{OC} raster
information,
initially in the \.{WD} file, then of writing the \.{OC} header
information into the \.{OC} file as it is being generated. We then pad
this out, as required, and only then copy the raster
information from the \.{WD} file into the \.{OC} file. The necessary
\.{WD} information will have been kept in core until after this transfer
and the \.{WD} file will be \\{rewrite} opened and written in its final
form.


Returning to a consideration of the \.{OC} file,
the header consists of a block of 24 half-words that are characteristic of
the font in general followed by a character width table and finally by the
character-segment pointers.

The \.{OC} format requires the different glyphs to be arranged in \\{char%
\_code}
order, although there is no such requirement in \.{MF}.
There need not be a complete set of 128 glyphs in the font but the format was
designed
on the assumption
that the set would be reasonably complete within a group from a
character number of \\{bc} through \\{ec}.  There will be a set of 8
half-words of width information for each character within this group (with
a standard notation for all missing glyphs).

There will be a similar set of \\{ec} $-$ \\{bc} $+$ 1 pointers, each
occupying two half-words, for the raster information for each character
(with pointers of $-1$ for missing characters).

The initial 24 half-words of the header will contain:
\smallskip\hang\noindent
0. A header for the family-name IX.
\smallskip\hang\noindent
1. The font name code.
\smallskip\hang\noindent
2..11.. A 20-character font identifier string.
\smallskip\hang\noindent
12. Header for orbit-chars IX.
\smallskip\hang\noindent
13. Name code again in left byte and logical size encoded as face byte.
\smallskip\hang\noindent
14. \\{bc} in left byte and \\{ec} in right byte.
\smallskip\hang\noindent
15. Physical size in micas (real).
\smallskip\hang\noindent
16. Rotation in minutes of arc.
\smallskip\hang\noindent
17..18. Starting file position of font segment.
\smallskip\hang\noindent
19..20. Font segment length.
\smallskip\hang\noindent
21. X resolution in units of pixels/(10 inchs) (real)
\smallskip\hang\noindent
22. Y resolution in units of pixels/(10 inches) (real).
\smallskip\hang\noindent
23. EndIX.
\smallskip

The 8 words of width information for each \\{ec}$-$\\{bc}$+1$ entry will
contain:
\smallskip\hang\noindent
0,1. X-width$*$xresolution$*(2↑(16))$.
\smallskip\hang\noindent
2,3. Y-width$*$yresolution$*(2↑(16))$.
\smallskip\hang\noindent
4. Bounding box x-offset.
\smallskip\hang\noindent
5. Bounding box y-offset.
\smallskip\hang\noindent
6. Bounding box x-width in scan lines.
\smallskip\hang\noindent
7. Bounding box y-height in bits.
\smallskip

Finally the raster information for each glyph will occupy a varying amount
of space up to a limit of
(((\\{right\_pixel}-\\{left\_pixel})*(\\{top\_pixel}-\\{bot\_pixel})+15)div 16
half-words,
although most glyphs will not occupy this much space.


\Y\P\D \37$\\{oc\_id}\S\.{"IX"}$\C{current version of \.{OC} format}\par
\P\D \37$\\{fontidentifier}\S\.{"This\ has\ to\ be\ fixed"}$\C{This will have
to be fixed}\par
\fi

\M74. \P$\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{glyph\_ptr}: \37\&{array} $[0\to\\{max\_glyph\_no}]$ \1\&{of}\5
\\{integer};\C{called charsegptr in MFDOVR}\2\6
\4\\{glyph\_cols}: \37\&{array} $[0\to\\{max\_glyph\_no}]$ \1\&{of}\5
\\{integer};\C{BBdxArray in MFDOVR}\2\6
\4\\{glyph\_rows}: \37\&{array} $[0\to\\{max\_glyph\_no}]$ \1\&{of}\5
\\{integer};\C{BBdyArray in MFDOVR}\2\6
\4\\{min\_x\_array}: \37\&{array} $[0\to\\{max\_glyph\_no}]$ \1\&{of}\5
\\{integer};\C{BBoxArray in MFDOVR}\2\6
\4\\{min\_y\_array}: \37\&{array} $[0\to\\{max\_glyph\_no}]$ \1\&{of}\5
\\{integer};\C{BBoyArray in MFDOVR}\2\6
\4\\{x\_char\_width}: \37\&{array} $[0\to\\{max\_glyph\_no}]$ \1\&{of}\5
\\{integer};\2\6
\4\\{cols\_offset}: \37\&{array} $[0\to\\{max\_glyph\_no}]$ \1\&{of}\5
\\{integer};\2\6
\4\\{rows\_offset}: \37\&{array} $[0\to\\{max\_glyph\_no}]$ \1\&{of}\5
\\{integer};\2\6
\4$\\{bc},\39\\{ec},\39\\{nc}$: \37\\{integer};\6
\4\\{oc\_dir\_ptr}: \37\\{integer};\6
\4\\{oc\_mag}: \37\\{integer};\6
\4\\{seg\_start}: \37\\{integer};\6
\4\\{seg\_end}: \37\\{integer};\6
\4\\{font\_face\_byte}: \37\\{integer};\6
\4\\{rel\_ptr\_base}: \37\\{integer};\6
\4\\{pix\_res}: \37\\{integer};\6
\4\\{fixed\_x}: \37\\{boolean};\C{true for a fixed-character-width font}\6
\4$\\{cols\_max},\39\\{rows\_max}$: \37\\{integer};\C{x and y dimensions of
font bounding box}\6
\4$\\{tfm\_min},\39\\{tfm\_max}$: \37\\{integer};\C{\\{tfm\_width} range for
font bounding box}\par
\fi

\M75. \P$\X15:Set initial values\X\mathrel{+}\S$\6
\&{for} $\|i\K0\mathrel{\&{to}}\\{max\_glyph\_no}$ \1\&{do}\6
\&{begin} \37$\\{glyph\_cols}[\|i]\K0$;\5
$\\{glyph\_rows}[\|i]\K0$;\5
$\\{cols\_offset}[\|i]\K0$;\5
$\\{rows\_offset}[\|i]\K0$;\5
$\\{glyph\_ptr}[\|i]\K-1$;\C{marks nonexistant character}\6
\&{end};\2\6
$\\{bc}\K\\{max\_glyph\_no}+1$;\5
$\\{ec}\K-1$;\5
$\\{tfm\_min}\K1000$;\5
$\\{tfm\_max}\K0$;\5
$\\{cols\_max}\K0$;\5
$\\{rows\_max}\K0$;\5
$\\{min\_x\_overall}\K\\{max\_int}$;\5
$\\{min\_y\_overall}\K\\{max\_int}$;\C{any large number will do}\6
$\\{max\_x\_overall}\K0$;\5
$\\{max\_y\_overall}\K0$;\par
\fi

\M76. There is a certain amount of initial information that must be written on
the \\{oc\_file}.

\Y\P$\4\X76:Write the \\{oc} initial information\X\S$\6
\&{begin} \37$\\{bc}\K0$;\6
\&{while} $(\\{glyph\_ptr}[\\{bc}]=-1)\W(\\{bc}<\\{max\_glyph\_no})$ \1\&{do}\5
$\\{incr}(\\{bc})$;\2\6
$\\{ec}\K\\{max\_glyph\_no}$;\6
\&{while} $(\\{glyph\_ptr}[\\{ec}]=-1)\W(\\{ec}>0)$ \1\&{do}\5
$\\{decr}(\\{ec})$;\2\6
\&{if} $\\{bc}>\\{ec}$ \1\&{then}\5
$\\{error}(\.{\'No\ characters\ in\ this\ font!\'})$;\2\6
$\\{nc}\K\\{ec}+1-\\{bc}$;\5
\\{print\_nl};\5
$\\{print}(\.{\'bc\ =\ \'},\39\\{bc}:1)$;\5
$\\{print}(\.{\'\ ec\ =\ \'},\39\\{ec}:1)$;\5
$\\{seg\_start}\K\\{char\_seg\_file\_pos}-(8+2)\ast\\{nc}$;\5
$\\{seg\_end}\K\\{char\_seg\_file\_pos}+(\\{wd\_byte\_no}\mathbin{\&{div}}2)$;\6
\&{if} $(\\{font\_face\_byte}<0)\V(\\{font\_face\_byte}>127)$ \1\&{then}\5
$\\{error}(\.{\'Fontface\ out\ of\ bnds\'})$;\2\6
$\\{oc\_halfword}(4108)$;\C{header for family-name IX}\6
$\\{oc\_halfword}(0)$;\C{name code}\6
$\\{oc\_word}(0)$;\C{$\\{oc\_string}(\\{fontidentifier},20)$; goes in here,
replacing 5 words}\6
$\\{oc\_word}(0)$;\5
$\\{oc\_word}(0)$;\5
$\\{oc\_word}(0)$;\5
$\\{oc\_word}(0)$;\5
$\\{oc\_halfword}(20491)$;\C{header for orbit-chars IX}\6
$\\{oc\_byte}(0)$;\C{name code again}\6
$\\{oc\_byte}(\\{bc})$;\C{charcode for the first glyph}\6
$\\{oc\_byte}(\\{ec})$;\C{charcode for the last glyph}\6
$\\{oc\_byte}(\\{font\_face\_byte})$;\C{logical size encoded as font face byte}%
\6
$\\{oc\_halfword}(\\{phys\_size}(\\{design\_size}))$;\C{physical size in micas}%
\6
$\\{oc\_halfword}(0)$;\C{rotation in minutes of arc}\6
$\\{oc\_word}(\\{char\_seg\_file\_pos})$;\C{starting file pos of font segment
in halfwords}\6
$\\{oc\_word}(\\{wd\_byte\_no}\mathbin{\&{div}}2)$;\C{font segment length in
half words}\6
$\\{pix\_res}\K\\{round}(3840/\\{magnification}+0.5)$;\5
$\\{oc\_halfword}(\\{pix\_res})$;\5
$\\{oc\_halfword}(\\{pix\_res})$;\5
$\\{oc\_halfword}(1)$;\C{endIX}\6
\&{if} $\\{oc\_byte\_no}\I48$ \1\&{then}\5
$\\{error}(\.{\'This\ cannot\ happen:\ header\ error\'})$;\C{$\\{print}(\\{oc%
\_byte\_no}:5)$;}\2\6
\&{while} $\\{oc\_byte\_no}<2\ast\\{seg\_start}$ \1\&{do}\5
$\\{oc\_halfword}(0)$;\2\6
$\|c\K\\{bc}$;\6
\&{while} $\|c\L\\{ec}$ \1\&{do}\6
\&{begin} \37\&{if} $\\{glyph\_ptr}[\|c]\I-1$ \1\&{then}\6
\&{begin} \37$\\{oc\_word}(\\{tfm\_width}[\|c])$;\C{*** this is probably not
correct ***}\6
$\\{oc\_word}(0)$;\C{assuming not vectorwidths}\6
$\\{oc\_halfword}(\\{min\_x\_array}[\|c])$;\5
$\\{oc\_halfword}(\\{min\_y\_array}[\|c])$;\5
$\\{oc\_halfword}(\\{glyph\_cols}[\|c])$;\5
$\\{oc\_halfword}(\\{glyph\_rows}[\|c])$;\6
\&{end}\6
\4\&{else} \&{begin} \37$\|i\K1$;\6
\&{while} $\|i\L7$ \1\&{do}\6
\&{begin} \37$\\{oc\_halfword}(0)$;\5
$\\{incr}(\|i)$;\6
\&{end};\2\6
$\\{oc\_halfword}(-1)$;\6
\&{end};\2\6
$\\{incr}(\|c)$;\6
\&{end};\2\6
$\\{rel\_ptr\_base}\K\\{char\_seg\_file\_pos}-2\ast\\{nc}$;\6
\&{if} $\\{oc\_byte\_no}\I2\ast\\{rel\_ptr\_base}$ \1\&{then}\5
$\\{error}(\.{\'rel\ ptr\ base\ error\'})$;\2\6
$\|c\K\\{bc}$;\6
\&{while} $\|c\L\\{ec}$ \1\&{do}\6
\&{begin} \37\&{if} $\\{glyph\_ptr}[\|c]\I-1$ \1\&{then}\5
$\\{oc\_word}(\\{glyph\_ptr}[\|c]-\\{rel\_ptr\_base})$\6
\4\&{else} $\\{oc\_word}(-1)$;\2\6
$\\{incr}(\|c)$;\6
\&{end};\2\6
$\\{close}(\\{wd\_file})$;\6
\&{end}\par
\U section~79.\fi

\M77. Certain parameters are computed as reals and then stored as integers.
It is possible for these parameters to exceed the bounds set by the .wd
format.

\Y\P\4\&{procedure}\1\  \37$\\{wd\_real}(\|r:\\{real})$;\6
\4\&{var} \37\\{int}: \37\\{integer};\2\6
\&{begin} \37$\\{int}\K\\{round}((\|r\ast1000/\\{design\_size})+0.5)$;\6
\&{if} $\\{abs}(\\{int})>32766$ \1\&{then}\5
$\\{error}(\.{\'value\ exceeds\ bounds\ of\ .wd\ format!\'})$;\2\6
$\\{wd\_halfword}(\\{int})$;\6
\&{end};\par
\fi

\M78. After copying the \\{oc} header information from the \.{WD} file into the
\.{WD}
file and resetting the \.{WD} file we can then write out the following:

\Y\P$\4\X78:Write \\{wd} information\X\S$\6
$\\{wd\_halfword}(4108)$;\C{header for family-name IX}\6
$\\{wd\_halfword}(0)$;\C{name code}\6
$\\{wd\_word}(0)$;\C{$\\{wd\_string}(\\{fontidentifier},20)$; goes in here,
replacing 5 words}\6
$\\{wd\_word}(0)$;\5
$\\{wd\_word}(0)$;\5
$\\{wd\_word}(0)$;\5
$\\{wd\_word}(0)$;\5
$\\{wd\_halfword}(20491)$;\C{header for orbit-chars IX}\6
$\\{wd\_byte}(0)$;\C{name code again}\6
$\\{wd\_byte}(\\{bc})$;\C{charcode for the first glyph}\6
$\\{wd\_byte}(\\{ec})$;\C{charcode for the last glyph}\6
$\\{wd\_byte}(\\{font\_face\_byte})$;\C{logical size encoded as font face byte}%
\6
$\\{wd\_halfword}(\\{phys\_size}(\\{design\_size}))$;\C{physical size in micas}%
\6
$\\{wd\_halfword}(0)$;\C{rotation in minutes of arc}\6
$\\{wd\_word}(22)$;\C{starting file pos of font segment in halfwords}\6
\&{if} $\\{fixed\_x}$ \1\&{then}\5
$\\{wd\_word}(7)$\6
\4\&{else} $\\{wd\_word}(\\{nc}+6)$;\C{data segment length in half words}\2\6
$\\{wd\_halfword}(1)$;\C{endIX}\6
\&{if} $\\{wd\_byte\_no}\I44$ \1\&{then}\5
$\\{error}(\.{\'This\ cannot\ happen:\ header\ error\'})$;\C{$\\{print}(\\{wd%
\_byte\_no}:5)$;}\2\6
$\\{wd\_real}(\\{min\_x\_overall}/\\{xresolution})$;\C{x offset of font
bounding box}\6
$\\{wd\_real}(\\{min\_y\_overall}/\\{yresolution})$;\C{y offset of font
bounding box}\6
$\\{wd\_real}(\\{cols\_max}/\\{xresolution})$;\C{x dimension of font bounding
box}\6
$\\{wd\_real}(\\{rows\_max}/\\{yresolution})$;\C{y dimension of font bounding
box}\6
\&{if} $\\{tfm\_min}=\\{tfm\_max}$ \1\&{then}\5
$\\{fixed\_x}\K\\{true}$\6
\4\&{else} $\\{fixed\_x}\K\\{false}$;\C{fixed-y is true always}\2\6
\&{if} $\\{fixed\_x}$ \1\&{then}\5
$\\{wd\_byte}(192)$\6
\4\&{else} $\\{wd\_byte}(64)$;\C{fixed flags}\2\6
$\\{wd\_byte}(0)$;\C{flags are actually stored in a half word, this fills it
out}\6
\&{if} $\\{fixed\_x}$ \1\&{then}\5
$\\{wd\_halfword}(\\{tfm\_max})$\6
\4\&{else} \&{begin} \37$\|c\K\\{bc}$;\6
\&{while} $\|c\L\\{ec}$ \1\&{do}\6
\&{begin} \37\&{if} $\\{glyph\_ptr}[\|c]=-1$ \1\&{then}\6
\&{begin} \37$\\{wd\_byte}(128)$;\5
$\\{wd\_byte}(0)$;\6
\&{end}\6
\4\&{else} $\\{wd\_halfword}(\\{tfm\_width}[\|c])$;\C{ *** this needs
verification *** }\2\6
$\\{incr}(\|c)$;\6
\&{end};\2\6
\&{end};\2\6
$\\{wd\_halfword}(0)$;\6
\&{if} $\\{wd\_byte\_no}\I56+2\ast\\{nc}$ \1\&{then}\6
\&{begin} \37\\{print\_nl};\5
$\\{print}(\\{wd\_byte\_no})$;\5
$\\{print}(\.{\'\ instead\ of\ \'},\3956+2\ast\\{nc}:1)$;\6
\&{end};\2\6
\&{if} $(\\{wd\_byte\_no}\mathbin{\&{mod}}4)\I0$ \1\&{then}\5
$\\{wd\_halfword}(0)$;\2\par
\U section~79.\fi

\N79.  The main program.
Now we are ready to put it all together. This is where \.{GFDOVER} starts,
and where it ends.

\Y\P\&{begin} \37\\{initialize};\C{get all variables initialized}\6
\\{open\_gf\_file};\5
\\{find\_postamble};\5
\\{read\_postamble};\5
\X81:Process the preamble\X;\6
\\{open\_oc\_file};\5
\\{open\_wd\_file};\5
\X82:Translate all the characters\X;\6
\X76:Write the \\{oc} initial information\X;\6
\\{move\_rasters};\5
\\{print\_nl};\5
$\\{print}(\.{\'Font\ had\ \'},\39\\{total\_chars}:1,\39\.{\'\ character\'})$;\6
\&{if} $\\{total\_chars}\I1$ \1\&{then}\5
$\\{print}(\.{\'s\'})$;\2\6
$\\{print}(\.{\'\ altogether\'})$;\5
\X78:Write \\{wd} information\X;\6
\4\\{final\_end}: \37\&{end}.\par
\fi

\M80. The main program needs a few global variables in order to do its work.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\|a: \37\\{integer};\C{byte number of the current command}\6
\4$\|b,\39\|i$: \37\\{integer};\C{used in accumulating output byte information}%
\6
\4$\|c,\39\|l,\39\|m,\39\|n,\39\|o,\39\|p,\39\|q,\39\|r$: \37\\{integer};%
\C{general purpose registers}\par
\fi

\M81. \.{GFDOVER} looks at the preamble in order to do error checking, and to
display the introductory comment.

\Y\P$\4\X81:Process the preamble\X\S$\6
\\{open\_gf\_file};\5
$\|o\K\\{get\_byte}$;\C{fetch the first byte}\6
\&{if} $\|o\I\\{pre}$ \1\&{then}\5
$\\{bad\_gf}(\.{\'First\ byte\ isn\'}\.{\'t\ start\ of\ preamble!\'})$;\2\6
$\|o\K\\{get\_byte}$;\C{fetch the identification byte}\6
\&{if} $\|o\I\\{gf\_id\_byte}$ \1\&{then}\5
$\\{error}(\.{\'identification\ byte\ should\ be\ \'},\39\\{gf\_id\_byte}:1,\39%
\.{\'\ not\ \'},\39\|o:1,\39\.{\'!\'})$;\2\6
$\|o\K\\{get\_byte}$;\C{fetch the length of the introductory comment}\6
$\\{print}(\.{\'\'}\.{\'\'})$;\6
\&{while} $\|o>0$ \1\&{do}\6
\&{begin} \37$\\{decr}(\|o)$;\5
$\\{print}(\\{xchr}[\\{get\_byte}])$;\6
\&{end};\2\6
$\\{print\_ln}(\.{\'\'}\.{\'\'})$;\par
\U section~79.\fi

\M82. \P$\X82:Translate all the characters\X\S$\6
\1\&{repeat} \37$\\{gf\_prev\_ptr}\K\\{cur\_loc}$;\5
\X83:Pass \\{nop}, \\{xxx} and \\{yyy} commands\X;\6
\&{if} $\|o\I\\{post}$ \1\&{then}\6
\&{begin} \37\&{if} $\|o\I\\{boc}$ \1\&{then}\5
$\\{bad\_gf}(\.{\'byte\ \'},\39\\{cur\_loc}-1:1,\39\.{\'\ is\ not\ boc\ (\'},%
\39\|o:1,\39\.{\')\'})$;\2\6
$\\{print}(\\{cur\_loc}:1)$;\5
$\\{print}(\.{\'\ [\'})$;\5
\X84:Pass a \\{boc} command\X;\6
\&{if} $\R\\{do\_char}$ \1\&{then}\5
$\\{bad\_gf}(\.{\'char\ ended\ unexpectedly\'})$;\2\6
\X85:Pass an \\{eoc} command\X;\6
\X59:Remove blank columns at the left\X;\6
\X60:Establish new value of \\{max\_x}\X;\6
\X61:Remove blank rows from top and bottom\X;\6
\\{tabulate};\5
\X62:Save data for the \\{oc} file\X;\6
\X65:Write the \\{oc} raster\X;\6
$\\{print}(\.{\']\ \'})$;\6
\&{end};\2\6
\4\&{until}\5
$\|o=\\{post}$;\2\par
\U section~79.\fi

\M83. \P$\X83:Pass \\{nop}, \\{xxx} and \\{yyy} commands\X\S$\6
\1\&{repeat} \37$\|a\K\\{cur\_loc}$;\5
$\|o\K\\{get\_byte}$;\5
$\|p\K\\{first\_par}(\|o)$;\6
\&{if} $\\{eof}(\\{gf\_file})$ \1\&{then}\5
$\\{bad\_gf}(\.{\'the\ file\ ended\ prematurely\'})$;\2\6
\&{if} $\|o=\\{yyy}$ \1\&{then}\6
\&{begin} \37\X50:Translate a \\{yyy} command\X;\6
$\|o\K\\{nop}$;\6
\&{end}\6
\4\&{else} \&{if} $(\|o\G\\{xxx1})\W(\|o\L\\{xxx1}+3)$ \1\&{then}\6
\&{begin} \37\X48:Translate an \\{xxx} command\X;\6
$\|o\K\\{nop}$;\6
\&{end};\2\2\6
\4\&{until}\5
$\|o\I\\{nop}$;\2\par
\U section~82.\fi

\M84. \P$\X84:Pass a \\{boc} command\X\S$\6
$\|a\K\\{cur\_loc}$;\5
$\\{incr}(\\{total\_chars})$;\5
$\\{char\_code}\K\\{signed\_quad}$;\5
$\|p\K\\{signed\_quad}$;\5
$\|c\K\\{char\_code}\mathbin{\&{mod}}256$;\6
\&{if} $\|c<0$ \1\&{then}\5
$\|c\K\|c+256$;\2\6
$\\{print}(\|c:1)$;\6
\&{if} $\\{char\_code}\I\|c$ \1\&{then}\5
$\\{print}(\.{\'\ in\ family\ \'},\39(\\{char\_code}-\|c)\mathbin{%
\&{div}}256:1)$;\2\6
$\\{min\_x\_stated}\K\\{signed\_quad}$;\5
$\\{max\_x\_stated}\K\\{signed\_quad}$;\5
$\\{min\_y\_stated}\K\\{signed\_quad}$;\5
$\\{max\_y\_stated}\K\\{signed\_quad}$;\5
$\|z\K\\{signed\_quad}$;\5
$\\{min\_z}\K\|z$;\5
$\\{min\_x\_observed}\K\\{max\_int}$;\5
$\\{max\_x\_observed}\K-\\{max\_int}$;\5
$\\{min\_y\_observed}\K\\{max\_int}$;\5
$\\{max\_y\_observed}\K-\\{max\_int}$;\6
\&{if} $\\{char\_ptr}[\|c]\I\|p$ \1\&{then}\5
$\\{error}(\.{\'previous\ character\ pointer\ should\ be\ \'},\39\\{char\_ptr}[%
\|c]:1,\39\.{\',\ not\ \'},\39\|p:1,\39\.{\'!\'})$;\2\6
$\\{char\_ptr}[\|c]\K\\{gf\_prev\_ptr}$;\5
$\|y\K\\{max\_y\_stated}$;\5
$\|x\K\|z$;\5
$\\{p\_c}\K0$;\5
$\\{p\_val}\K\\{white}$;\5
$\\{p\_array}\K\|z$;\5
$\\{incr}(\\{p\_c})$;\5
$\\{p\_array}\K0$;\par
\U section~82.\fi

\M85. \P$\X85:Pass an \\{eoc} command\X\S$\6
\&{if} $\\{min\_x\_observed}<\\{min\_x\_overall}$ \1\&{then}\5
$\\{min\_x\_overall}\K\\{min\_x\_observed}$;\2\6
\&{if} $\\{max\_x\_observed}>\\{max\_x\_overall}$ \1\&{then}\5
$\\{max\_x\_overall}\K\\{max\_x\_observed}$;\2\6
\&{if} $\\{min\_y\_observed}<\\{min\_y\_overall}$ \1\&{then}\5
$\\{min\_y\_overall}\K\\{min\_y\_observed}$;\2\6
\&{if} $\\{max\_y\_observed}>\\{max\_y\_overall}$ \1\&{then}\5
$\\{max\_y\_overall}\K\\{max\_y\_observed}$;\2\par
\U section~82.\fi

\N86.  System-dependent changes.
This section should be replaced, if necessary, by changes to the program
that are necessary to make \.{GFDOVER} work at a particular installation.
It is usually best to design your change file so that all changes to
previous sections preserve the section numbering; then everybody's version
will be consistent with the printed program. More extensive changes,
which introduce new sections, can be inserted here; then only the index
itself will get a new section number.
\fi

\N87.  Index.
Pointers to error messages appear here together with the section numbers
where each ident\-i\-fier is used.
\fi


\inx
\:\|{a}, \[32], \[80].
\:\\{abort}, \[7], 71.
\:\\{abs}, 77.
\:\.{all 223s}, 72.
\:\\{ASCII\_code}, 10, 11, \[12], 14.
\:\|{b}, \[32], \[56], \[80].
\:\.{Bad GF file}, 7.
\:\\{bad\_char}, 48, \[49].
\:\\{bad\_gf}, \[7], 44, 70, 72, 81, 82, 83.
\:\\{banner}, \[1], 3.
\:\\{bc}, 73, \[74], 75, 76, 78.
\:\\{black}, 18, 19, \[39], 53, 59.
\:\\{boc}, 17, 19, \[20], 22, 36, 42, 43, 47, 61, 82.
\:\.{boc occurred before eoc}, 47.
\:\\{boolean}, 39, 43, 49, 74.
\:\\{bot\_pixel}, \[5], 6, 37, 73.
\:\\{buffer}, \[10].
\:\.{byte n is not post}, 72.
\:\\{byte\_file}, \[24], 25.
\:\|{c}, \[11], \[32], \[68], \[80].
\:\\{char}, 13.
\:\\{char\_code}, \[40], 62, 65, 73, 84.
\:\\{char\_loc}, 19, \[20], 22, 42, 71.
\:\\{char\_ptr}, \[40], 41, 84.
\:\\{char\_seg\_file\_pos}, \[64], 65, 76.
\:\\{check\_sum}, 68, \[69].
\:{Chinese characters}, 22.
\:\\{chr}, 9, 13, 14, 16.
\:\\{close}, 56, 76.
\:\\{cols\_max}, \[74], 75, 78.
\:\\{cols\_offset}, \[74], 75.
\:\\{complement}, \[39], 63.
\:\\{cs}, \[21].
\:\\{cur\_loc}, 27, \[31], 32, 35, 44, 68, 70, 82, 83, 84.
\:\\{cur\_pos}, 35.
\:\|{d}, \[32].
\:\\{decr}, \[6], 48, 53, 54, 57, 60, 61, 65, 66, 67, 72, 76, 81.
\:\\{delta}, \[9].
\:\\{design\_size}, 68, \[69], 76, 77, 78.
\:\\{device\_width}, \[69], 71.
\:\\{do\_char}, 36, 42, \[43], 46, 82.
\:\\{do\_nothing}, \[6], 47.
\:\\{ds}, \[21].
\:\\{ec}, 73, \[74], 75, 76, 78.
\:\\{eight\_bits}, \[24], 32, 42, 43, 56.
\:\\{eight\_cases}, \[42].
\:\\{eighty\_three\_cases}, \[42].
\:\&{else}, 2.
\:\&{end}, 2.
\:\&{endcases}, \[2].
\:\\{eoc}, 17, 19, \[20], 21, 42, 47, 61.
\:\\{eof}, 32, 35, 44, 56, 70, 83.
\:\\{error}, \[44], 46, 47, 48, 65, 70, 76, 77, 78, 81, 84.
\:\\{false}, 39, 43, 48, 51, 78.
\:\\{final\_end}, \[4], 7, 79.
\:\\{find\_postamble}, \[72], 79.
\:\.{First byte isn't...}, 81.
\:\\{first\_par}, \[42], 44, 46, 71, 83.
\:\\{first\_text\_char}, \[13], 16.
\:\\{fix\_val}, \[63], 65, 66, 67.
\:\\{fix\_word}, 22.
\:\\{fixed\_x}, \[74], 78.
\:\\{font\_face\_byte}, \[74], 76, 78.
\:\\{fontidentifier}, \[73], 76, 78.
\:\\{four\_cases}, \[42], 46.
\:{Fuchs, David Raymond}, 23.
\:\\{get\_byte}, \[32], 35, 42, 44, 48, 70, 71, 72, 81, 83.
\:\\{get\_three\_bytes}, \[32], 42.
\:\\{get\_two\_bytes}, \[32], 42.
\:\\{gf\_file}, \[3], \[25], 26, 27, 31, 32, 35, 44, 70, 83.
\:\\{gf\_id\_byte}, \[19], 70, 72, 81.
\:\\{gf\_length}, \[35], 72.
\:\\{gf\_prev\_ptr}, \[40], 82, 84.
\:\\{GF\_to\_OC}, \[3], 5.
\:\\{glyph\_cols}, 62, \[74], 75, 76.
\:\\{glyph\_ptr}, 65, \[74], 75, 76, 78.
\:\\{glyph\_rows}, 62, \[74], 75, 76.
\:\\{hppp}, \[21], 68, \[69].
\:\|{i}, \[3].
\:\.{ID byte is wrong}, 72.
\:\.{identification byte should be n}, 70, 81.
\:\\{incr}, \[6], 32, 33, 34, 52, 53, 54, 57, 59, 60, 61, 63, 65, 66, 67, 76,
78, 84.
\:\\{initialize}, \[3], 79.
\:\\{input\_ln}, 10.
\:\\{int}, \[77].
\:\\{integer}, 3, 9, 31, 32, 33, 34, 35, 38, 40, 42, 43, 55, 57, 68, 69, 72,
74, 77, 80.
\:{Japanese characters}, 22.
\:\\{jump\_out}, \[7].
\:\|{k}, \[68], \[72].
\:\|{l}, \[80].
\:\\{last\_text\_char}, \[13], 16.
\:\\{left\_pixel}, \[5], 6, 37, 73.
\:\\{left\_z\_1}, \[19].
\:\\{left\_z\_83}, \[19], \[20], 42.
\:\\{line\_length}, \[5].
\:\\{lower\_casify}, \[11].
\:\|{m}, \[68], \[80].
\:\\{magnification}, 55, 68, \[69], 76.
\:\\{max\_glyph\_no}, \[5], 41, 69, 71, 74, 75, 76.
\:\\{max\_int}, 75, 84.
\:\\{max\_p\_c}, \[5], 37, 38.
\:\\{max\_p\_c\_allowed}, 39.
\:\\{max\_x}, 19, \[21], 60, 62, 66, 67, 68, \[69].
\:\\{max\_x\_allowed}, \[6].
\:\\{max\_x\_observed}, 52, \[69], 84, 85.
\:\\{max\_x\_overall}, \[69], 75, 85.
\:\\{max\_x\_stated}, \[69], 84.
\:\\{max\_y}, 19, \[21], 59, 60, 61, 62, 65, 66, 67, 68, \[69].
\:\\{max\_y\_allowed}, \[6], 38, 39.
\:\\{max\_y\_observed}, 52, 57, \[69], 84, 85.
\:\\{max\_y\_overall}, \[69], 75, 85.
\:\\{max\_y\_stated}, 59, \[69], 84.
\:\\{min\_x}, 19, \[21], 59, 60, 62, 65, 68, \[69].
\:\\{min\_x\_allowed}, \[6].
\:\\{min\_x\_array}, 62, \[74], 76.
\:\\{min\_x\_observed}, 52, \[69], 84, 85.
\:\\{min\_x\_overall}, \[69], 75, 78, 85.
\:\\{min\_x\_stated}, 59, \[69], 84.
\:\\{min\_y}, 19, \[21], 59, 60, 61, 62, 65, 66, 67, 68, \[69].
\:\\{min\_y\_allowed}, \[6], 38, 39.
\:\\{min\_y\_array}, 62, \[74], 76.
\:\\{min\_y\_observed}, 52, 57, \[69], 84, 85.
\:\\{min\_y\_overall}, \[69], 75, 78, 85.
\:\\{min\_y\_stated}, 59, \[69], 84.
\:\\{min\_z}, \[38], 53, 59, 84.
\:\\{move\_rasters}, \[56], 79.
\:\\{move\_to\_byte}, \[35], 72.
\:\|{n}, \[80].
\:\\{n\_r\_flag}, \[49], 51, 53, 54.
\:\\{nc}, \[74], 76, 78.
\:\\{negate}, \[6], 9.
\:\\{new\_row}, 19, \[20], 42, 46.
\:\\{newrow}, 49.
\:\\{nine\_cases}, \[42].
\:\\{nineteen\_cases}, \[42].
\:\.{non-ASCII character...}, 48.
\:\\{nop}, \[19], \[20], 22, 42, 47, 71, 83.
\:\.{not enough signature bytes...}, 70.
\:\|{o}, \[43], \[80].
\:\\{oc}, 1, 36, 58, 60, 61, 62, 64, 65, 78.
\:\\{oc\_byte}, \[33], 56, 76.
\:\\{oc\_byte\_no}, 28, \[31], 33, 76.
\:\\{oc\_dir\_ptr}, \[74].
\:\\{oc\_file}, \[3], \[25], 28, 31, 33, 56, 58, 76.
\:\\{oc\_halfword}, \[33], 76.
\:\\{oc\_id}, \[73].
\:\\{oc\_mag}, 68, \[74].
\:\\{oc\_string}, 76.
\:\\{oc\_word}, \[33], 76.
\:\\{open\_gf\_file}, \[27], 79, 81.
\:\\{open\_oc\_file}, \[28], 79.
\:\\{open\_wd\_file}, \[29], 56, 79.
\:\\{ord}, 9, 14.
\:{oriental characters}, 22.
\:\&{othercases}, \[2].
\:\\{others}, 2.
\:\\{output}, \[3].
\:\|{p}, \[43], \[68], \[80].
\:\\{p\_array}, \[39], 52, 53, 57, 59, 60, 61, 63, 65, 66, 67, 84.
\:\\{p\_c}, 36, \[38], 39, 52, 53, 57, 59, 60, 61, 63, 65, 84.
\:\\{p\_c\_coord}, \[37], 38.
\:\\{p\_val}, \[39], 53, 54, 57, 59, 63, 65, 66, 67, 84.
\:\\{paint}, 36, 51, 61.
\:\\{paint\_array}, 36, \[38], 39, 51, 54, 59, 63.
\:\\{paint\_switch}, \[18], 19, \[38].
\:\\{paint\_val}, 18, 36, \[38], 39, 54.
\:\\{paint\_0}, 19, \[20], 42.
\:\\{paint1}, 19, \[20], 42, 46, 51.
\:\\{paint2}, \[19].
\:\\{paint3}, \[19].
\:\\{phys\_size}, \[55], 76, 78.
\:\\{pix\_res}, \[74], 76.
\:\\{pixel}, 38, \[39].
\:\\{post}, 17, 19, \[20], 21, 23, 42, 47, 68, 72, 82.
\:\.{post pointer is wrong}, 72.
\:\\{post\_loc}, 68, \[69], 70, 72.
\:\\{post\_post}, 19, \[20], 21, 23, 42, 47, 70.
\:\.{postamble command within a page}, 47.
\:\.{postamble pointer should be...}, 70.
\:\.{Postamble starts at byte n}, 68.
\:\\{ppi}, \[1], 55.
\:\\{pre}, 17, 19, \[20], 42, 47, 81.
\:\.{preamble command within a page}, 47.
\:\\{print}, \[3], 7, 9, 44, 54, 57, 60, 61, 68, 76, 78, 79, 81, 82, 84.
\:\\{print\_ln}, \[3], 43, 57, 68, 81.
\:\\{print\_nl}, \[3], 44, 47, 54, 57, 60, 61, 76, 78, 79.
\:\\{print\_scaled}, \[9], 68.
\:\|{q}, \[43], \[68], \[72], \[80].
\:\|{r}, \[55], \[80].
\:\\{read}, 32, 56.
\:\\{read\_postamble}, \[68], 79.
\:\\{real}, 55, 69, 77.
\:\\{rel\_ptr\_base}, \[74], 76.
\:\\{reopen\_wd\_file}, \[30], 56.
\:\\{reset}, 26, 27, 30.
\:\\{resolution}, \[1], 68.
\:\\{rewrite}, 28, 29, 73.
\:\\{right\_pixel}, \[5], 6, 37, 73.
\:\\{right\_z\_0}, 19, \[20], 42.
\:\\{right\_z\_1}, \[19], \[20], 42.
\:\\{right\_z\_83}, \[19], \[20], 46.
\:\\{round}, 55, 68, 76, 77.
\:\\{rows\_max}, 74, 75, 78.
\:\\{rows\_offset}, \[74], 75.
\:\|{s}, \[9].
\:\\{scaled}, 21.
\:\\{seg\_end}, \[74], 76.
\:\\{seg\_start}, \[74], 76.
\:\\{set\_pos}, 35.
\:\.{should be postpost}, 70.
\:\\{show\_label}, \[44].
\:\.{signature...should be...}, 70.
\:\\{signed\_quad}, \[32], 42, 68, 70, 71, 72, 84.
\:\\{sixteen\_cases}, \[42].
\:\\{sixty\_four\_cases}, \[42].
\:\\{skip}, 61.
\:\\{skip1}, 19, \[20], 42, 46.
\:\\{skip2}, \[19].
\:\\{skip3}, \[19].
\:\\{start\_op}, \[44], 51.
\:\.{string of negative length}, 48.
\:{system dependencies}, \[2], 7, 10, 13, 23, 24, 32, 35, \[64], 86.
\:\\{tabulate}, \[57], 82.
\:\\{term\_in}, \[10].
\:\\{term\_out}, \[10].
\:\\{terminal\_line\_length}, \[5], 10.
\:\\{text\_char}, \[13], 14.
\:\\{text\_file}, 10, \[13].
\:\\{tfm\_max}, 71, 74, 75, 78.
\:\\{tfm\_min}, 71, \[74], 75, 78.
\:\\{tfm\_width}, \[69], 71, 74, 76, 78.
\:\.{the file ended prematurely}, 44, 83.
\:\\{thirty\_two\_cases}, \[42].
\:\\{three\_cases}, \[42], 46.
\:\\{top\_pixel}, \[5], 6, 37, 73.
\:\\{total\_chars}, \[40], 41, 79, 84.
\:\\{true}, 39, 43, 48, 53, 54, 78.
\:\.{undefined command}, 46.
\:\\{undefined\_commands}, \[20], 42.
\:\\{unity}, \[8], 9.
\:\\{vppp}, \[21], 68, \[69].
\:\|{w}, \[33], \[34].
\:\\{wd}, 1, 56.
\:\\{wd\_byte}, \[34], 65, 78.
\:\\{wd\_byte\_no}, 29, 30, \[31], 34, 65, 76, 78.
\:\\{wd\_file}, \[3], \[25], 29, 30, 31, 34, 56, 58, 65, 76.
\:\\{wd\_halfword}, \[34], 77, 78.
\:\\{wd\_real}, \[77], 78.
\:\\{wd\_string}, 78.
\:\\{wd\_word}, \[34], 78.
\:\\{white}, \[39], 53, 54, 84.
\:\\{write}, 3, 33, 34.
\:\\{write\_ln}, 3.
\:\|{x}, \[38].
\:\\{x\_char\_width}, \[74].
\:\\{x\_coord}, \[37], 38.
\:\\{xchr}, \[14], 15, 16, 81.
\:\\{xord}, \[14], 16.
\:\\{xresolution}, \[1], 78.
\:\\{xxx1}, 19, \[20], 42, 46, 83.
\:\\{xxx2}, \[19].
\:\\{xxx3}, 19.
\:\\{xxx4}, \[19].
\:\|{y}, \[38], \[57].
\:\\{y\_coord}, \[37], 38.
\:\\{yresolution}, \[1], 78.
\:\\{yyy}, 19, \[20], 22, 42, 46, 83.
\:\|{z}, \[38].
\fin
\:\X47:Cases for commands \\{nop}, \\{pre}, \\{post}, \\{post\_post}, \\{boc},
and \\{eoc}\X
\U section~46.
\:\X5, 64:Constants in the outer block\X
\U section~3.
\:\X60:Establish new value of \\{max\_x}\X
\U section~82.
\:\X66:Get full byte\X
\U section~65.
\:\X67:Get mixed byte\X
\U section~65.
\:\X10, 14, 25, 31, 38, 40, 49, 69, 74, 80:Globals in the outer block\X
\U section~3.
\:\X4:Labels in the outer block\X
\U section~3.
\:\X70:Make sure that the end of the file is well-formed\X
\U section~68.
\:\X84:Pass a \\{boc} command\X
\U section~82.
\:\X85:Pass an \\{eoc} command\X
\U section~82.
\:\X83:Pass \\{nop}, \\{xxx} and \\{yyy} commands\X
\U section~82.
\:\X71:Process the character locations in the postamble\X
\U section~68.
\:\X81:Process the preamble\X
\U section~79.
\:\X59:Remove blank columns at the left\X
\U section~82.
\:\X61:Remove blank rows from top and bottom\X
\U section~82.
\:\X62:Save data for the \\{oc} file\X
\U section~82.
\:\X15, 16, 41, 75:Set initial values\X
\U section~3.
\:\X46:Start translation of command \|o and \&{goto}  the appropriate label to
finish the job\X
\U section~44.
\:\X52:Store it away\X
\U section~51.
\:\X51:Translate a sequence of \\{paint} commands, until reaching a non-%
\\{paint}\X
\U section~46.
\:\X53:Translate a \\{new\_row}, \\{right} or \\{left} command\X
\U section~46.
\:\X54:Translate a \\{skip} command\X
\U section~46.
\:\X50:Translate a \\{yyy} command\X
\U sections~46 and~83.
\:\X82:Translate all the characters\X
\U section~79.
\:\X48:Translate an \\{xxx} command\X
\U sections~46 and~83.
\:\X44:Translate the next command in the \.{GF} file; \&{goto} 9999 if it was %
\\{eoc}; \&{goto} 9998 if premature termination is needed\X
\U section~43.
\:\X12, 13, 24, 37, 39:Types in the outer block\X
\U section~3.
\:\X76:Write the \\{oc} initial information\X
\U section~79.
\:\X65:Write the \\{oc} raster\X
\U section~82.
\:\X78:Write \\{wd} information\X
\U section~79.
\con